Documentation
¶
Index ¶
- Constants
- func Cert(cert, key string) tls.Certificate
- func LocalCert(cache ...string) tls.Certificate
- type App
- func (a *App) Listen(addr string, ts ...Transport) *App
- func (a *App) OnBind(cb func(addr string)) *App
- func (a *App) OnStart(cb func()) *App
- func (a *App) OnStop(cb func()) *App
- func (a *App) Serve(r router.Builder) error
- func (a *App) Stop()
- func (a *App) TLS(addr string, certs ...tls.Certificate) *App
- func (a *App) Tune(cfg *config.Config) *App
- type Transport
Constants ¶
const Version = "0.17.0"
Variables ¶
This section is empty.
Functions ¶
func Cert ¶ added in v0.17.0
func Cert(cert, key string) tls.Certificate
Cert loads the TLS certificate. Panics if an error happened.
func LocalCert ¶ added in v0.17.0
func LocalCert(cache ...string) tls.Certificate
LocalCert issues a self-signed certificate for local TLS-secured connections. Please note, that self-signed certificates are failing security checks, so browsers and tools (e.g. curl) may refuse to connect without adding security check skip flags (in particular, -k or --insecure for curl.)
Types ¶
type App ¶ added in v0.15.0
type App struct {
// contains filtered or unexported fields
}
App is just a struct with addr and shutdown channel that is currently not used. Planning to replace it with context.WithCancel()
func (*App) OnBind ¶ added in v0.16.0
OnBind callback is called every time a listener is ready to accept new connections.
func (*App) OnStart ¶ added in v0.16.0
OnStart calls the callback at the moment, when all the servers are started. However, it isn't strongly guaranteed that they'll be able to accept new connections immediately.
func (*App) OnStop ¶ added in v0.16.0
OnStop calls the callback at the moment, when all the servers are down. It's guaranteed, that at the moment as the callback is called, the server isn't able to accept any new connections and all the clients are already disconnected.
func (*App) Serve ¶ added in v0.15.0
Serve starts the web-application. If nil is passed instead of a router, empty inbuilt will be used.
func (*App) Stop ¶ added in v0.15.0
func (a *App) Stop()
Stop stops the whole application immediately and waits until it _really_ stops.
type Transport ¶ added in v0.17.0
type Transport struct {
// contains filtered or unexported fields
}
func Autocert ¶ added in v0.17.0
Autocert tries to automatically issue a certificate for the given domains. If operation succeeds, those will be (hopefully) saved into the default cache directory, which depends on the OS. If you want to specify the cache directory, use AutocertWithCache instead.
func AutocertWithCache ¶ added in v0.17.0
AutocertWithCache tries to automatically issue a certificate for the given domains. If the operation succeeds, those will be (hopefully) saved into the provided cache directory. It's recommended to use Autocert if there are no explicit needs to set custom cache directory.
func TLS ¶ added in v0.17.0
func TLS(certs ...tls.Certificate) Transport
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
compression
command
|
|
|
connhijack
command
|
|
|
demo
command
|
|
|
dynroute
command
|
|
|
helloworld
command
|
|
|
helloworld_norouter
command
|
|
|
middlewares
command
|
|
|
internal
|
|