MCPcopy
hub / github.com/gin-gonic/gin / RunTLS

Method RunTLS

gin.go:561–576  ·  view source on GitHub ↗

RunTLS attaches the router to a http.Server and starts listening and serving HTTPS (secure) requests. It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router) Note: this method will block the calling goroutine indefinitely unless an error happens.

(addr, certFile, keyFile string)

Source from the content-addressed store, hash-verified

559// It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router)
560// Note: this method will block the calling goroutine indefinitely unless an error happens.
561func (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) {
562 debugPrint("Listening and serving HTTPS on %s\n", addr)
563 defer func() { debugPrintError(err) }()
564
565 if engine.isUnsafeTrustedProxies() {
566 debugPrint("[WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\n" +
567 "Please check https://github.com/gin-gonic/gin/blob/master/docs/doc.md#dont-trust-all-proxies for details.")
568 }
569
570 server := &http.Server{ // #nosec G112
571 Addr: addr,
572 Handler: engine.Handler(),
573 }
574 err = server.ListenAndServeTLS(certFile, keyFile)
575 return
576}
577
578// RunUnix attaches the router to a http.Server and starts listening and serving HTTP requests
579// through the specified unix socket (i.e. a file).

Callers 3

TestRunTLSFunction · 0.80
TestPusherFunction · 0.80
RunTLSFunction · 0.80

Calls 4

HandlerMethod · 0.95
debugPrintFunction · 0.85
debugPrintErrorFunction · 0.85

Tested by 2

TestRunTLSFunction · 0.64
TestPusherFunction · 0.64