mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 04:57:07 +08:00
Merge cc75936e9410f62b06f3c6c2e34fe03d29e91b42 into 0397e5e0c0f8f8176c29f7edd8f1bff8e45df780
This commit is contained in:
commit
18d3582dc3
2
doc.go
2
doc.go
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Package gin implements a HTTP web framework called gin.
|
Package gin implements an HTTP web framework called gin.
|
||||||
|
|
||||||
See https://gin-gonic.com/ for more information about gin.
|
See https://gin-gonic.com/ for more information about gin.
|
||||||
*/
|
*/
|
||||||
|
2
fs.go
2
fs.go
@ -17,7 +17,7 @@ type neuteredReaddirFile struct {
|
|||||||
http.File
|
http.File
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dir returns a http.FileSystem that can be used by http.FileServer(). It is used internally
|
// Dir returns an http.FileSystem that can be used by http.FileServer(). It is used internally
|
||||||
// in router.Static().
|
// in router.Static().
|
||||||
// if listDirectory == true, then it works the same as http.Dir() otherwise it returns
|
// if listDirectory == true, then it works the same as http.Dir() otherwise it returns
|
||||||
// a filesystem that prevents http.FileServer() to list the directory files.
|
// a filesystem that prevents http.FileServer() to list the directory files.
|
||||||
|
10
gin.go
10
gin.go
@ -383,7 +383,7 @@ func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {
|
|||||||
return routes
|
return routes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run attaches the router to a http.Server and starts listening and serving HTTP requests.
|
// Run attaches the router to an http.Server and starts listening and serving HTTP requests.
|
||||||
// It is a shortcut for http.ListenAndServe(addr, router)
|
// It is a shortcut for http.ListenAndServe(addr, router)
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
func (engine *Engine) Run(addr ...string) (err error) {
|
func (engine *Engine) Run(addr ...string) (err error) {
|
||||||
@ -503,7 +503,7 @@ func parseIP(ip string) net.IP {
|
|||||||
return parsedIP
|
return parsedIP
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunTLS attaches the router to a http.Server and starts listening and serving HTTPS (secure) requests.
|
// RunTLS attaches the router to an http.Server and starts listening and serving HTTPS (secure) requests.
|
||||||
// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)
|
// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
func (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) {
|
func (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) {
|
||||||
@ -519,7 +519,7 @@ func (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunUnix attaches the router to a http.Server and starts listening and serving HTTP requests
|
// RunUnix attaches the router to an http.Server and starts listening and serving HTTP requests
|
||||||
// through the specified unix socket (i.e. a file).
|
// through the specified unix socket (i.e. a file).
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
func (engine *Engine) RunUnix(file string) (err error) {
|
func (engine *Engine) RunUnix(file string) (err error) {
|
||||||
@ -542,7 +542,7 @@ func (engine *Engine) RunUnix(file string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunFd attaches the router to a http.Server and starts listening and serving HTTP requests
|
// RunFd attaches the router to an http.Server and starts listening and serving HTTP requests
|
||||||
// through the specified file descriptor.
|
// through the specified file descriptor.
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
func (engine *Engine) RunFd(fd int) (err error) {
|
func (engine *Engine) RunFd(fd int) (err error) {
|
||||||
@ -564,7 +564,7 @@ func (engine *Engine) RunFd(fd int) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunListener attaches the router to a http.Server and starts listening and serving HTTP requests
|
// RunListener attaches the router to an http.Server and starts listening and serving HTTP requests
|
||||||
// through the specified net.Listener
|
// through the specified net.Listener
|
||||||
func (engine *Engine) RunListener(listener net.Listener) (err error) {
|
func (engine *Engine) RunListener(listener net.Listener) (err error) {
|
||||||
debugPrint("Listening and serving HTTP on listener what's bind with address@%s", listener.Addr())
|
debugPrint("Listening and serving HTTP on listener what's bind with address@%s", listener.Addr())
|
||||||
|
10
ginS/gins.go
10
ginS/gins.go
@ -104,7 +104,7 @@ func StaticFile(relativePath, filepath string) gin.IRoutes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Static serves files from the given file system root.
|
// Static serves files from the given file system root.
|
||||||
// Internally a http.FileServer is used, therefore http.NotFound is used instead
|
// Internally an http.FileServer is used, therefore http.NotFound is used instead
|
||||||
// of the Router's NotFound handler.
|
// of the Router's NotFound handler.
|
||||||
// To use the operating system's file system implementation,
|
// To use the operating system's file system implementation,
|
||||||
// use :
|
// use :
|
||||||
@ -131,28 +131,28 @@ func Routes() gin.RoutesInfo {
|
|||||||
return engine().Routes()
|
return engine().Routes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run attaches to a http.Server and starts listening and serving HTTP requests.
|
// Run attaches to an http.Server and starts listening and serving HTTP requests.
|
||||||
// It is a shortcut for http.ListenAndServe(addr, router)
|
// It is a shortcut for http.ListenAndServe(addr, router)
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
func Run(addr ...string) (err error) {
|
func Run(addr ...string) (err error) {
|
||||||
return engine().Run(addr...)
|
return engine().Run(addr...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunTLS attaches to a http.Server and starts listening and serving HTTPS requests.
|
// RunTLS attaches to an http.Server and starts listening and serving HTTPS requests.
|
||||||
// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)
|
// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
func RunTLS(addr, certFile, keyFile string) (err error) {
|
func RunTLS(addr, certFile, keyFile string) (err error) {
|
||||||
return engine().RunTLS(addr, certFile, keyFile)
|
return engine().RunTLS(addr, certFile, keyFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunUnix attaches to a http.Server and starts listening and serving HTTP requests
|
// RunUnix attaches to an http.Server and starts listening and serving HTTP requests
|
||||||
// through the specified unix socket (i.e. a file)
|
// through the specified unix socket (i.e. a file)
|
||||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||||
func RunUnix(file string) (err error) {
|
func RunUnix(file string) (err error) {
|
||||||
return engine().RunUnix(file)
|
return engine().RunUnix(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunFd attaches the router to a http.Server and starts listening and serving HTTP requests
|
// RunFd attaches the router to an http.Server and starts listening and serving HTTP requests
|
||||||
// through the specified file descriptor.
|
// through the specified file descriptor.
|
||||||
// Note: the method will block the calling goroutine indefinitely unless on error happens.
|
// Note: the method will block the calling goroutine indefinitely unless on error happens.
|
||||||
func RunFd(fd int) (err error) {
|
func RunFd(fd int) (err error) {
|
||||||
|
@ -188,7 +188,7 @@ func (group *RouterGroup) staticFileHandler(relativePath string, handler Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Static serves files from the given file system root.
|
// Static serves files from the given file system root.
|
||||||
// Internally a http.FileServer is used, therefore http.NotFound is used instead
|
// Internally an http.FileServer is used, therefore http.NotFound is used instead
|
||||||
// of the Router's NotFound handler.
|
// of the Router's NotFound handler.
|
||||||
// To use the operating system's file system implementation,
|
// To use the operating system's file system implementation,
|
||||||
// use :
|
// use :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user