Documentation ¶
Overview ¶
Package net is a collection of network listeners for use with an HTTP server.
Index ¶
- func LoadPlugin()
- type AcmeConfig
- func (a *AcmeConfig) Accept() (net.Conn, error)
- func (a *AcmeConfig) Addr() net.Addr
- func (a *AcmeConfig) Close() error
- func (a *AcmeConfig) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
- func (a *AcmeConfig) GetManager() (*autocert.Manager, error)
- func (a *AcmeConfig) Listener() (net.Listener, error)
- func (a *AcmeConfig) UnmarshalJSON(d []byte) error
- type BasicListener
- type BasicTLSListener
- type PemConfig
- type TLSCertificateGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadPlugin ¶
func LoadPlugin()
LoadPlugin being called forces the package to be loaded in order to ensure that the resource types are registered during the package's Init.
Types ¶
type AcmeConfig ¶
type AcmeConfig struct { AcceptTOS bool Domains []string // contains filtered or unexported fields }
AcmeConfig represents the configuration details to be used with x/crypto/acme/autocert. It can also act as a wrapper around the autocert.Manager and net.Listener it generates.
func (*AcmeConfig) Accept ¶
func (a *AcmeConfig) Accept() (net.Conn, error)
Accept implements net.Listener.
func (*AcmeConfig) GetCertificate ¶
func (a *AcmeConfig) GetCertificate( hello *tls.ClientHelloInfo, ) (*tls.Certificate, error)
GetCertificate implements TlsCertificateGetter so that this object can be used as part of another net.Listener in case behavior other than what is provided by AcmeConfig.Listener is desired.
func (*AcmeConfig) GetManager ¶
func (a *AcmeConfig) GetManager() (*autocert.Manager, error)
GetManager retrieves an x/crypto/acme/autocert.Manager with the previously defined config values. Subsequent calls return the same autocert.Manager object which has been preserved.
func (*AcmeConfig) Listener ¶
func (a *AcmeConfig) Listener() (net.Listener, error)
Listener retrieves a net.Listener from the autocert.Manager given by AcmeConfig.GetManager. Subsequent calls return the same net.Listener object which has been preserved.
func (*AcmeConfig) UnmarshalJSON ¶
func (a *AcmeConfig) UnmarshalJSON(d []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.
type BasicListener ¶
BasicListener augments the functionality of a net.Listen call by wrapping it in an encoding/json.Unmarshaler (and thereby making it be configurable).
func (*BasicListener) Accept ¶
func (b *BasicListener) Accept() (net.Conn, error)
Accept implements net.Listener.
func (*BasicListener) UnmarshalJSON ¶
func (b *BasicListener) UnmarshalJSON(d []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.
type BasicTLSListener ¶
type BasicTLSListener struct { Listener net.Listener CertGetter TLSCertificateGetter // contains filtered or unexported fields }
BasicTLSListener combines the certificate retrieval process abstracted by a TLSCertificateGetter with a supplied net.Listener to give a simple configurable wrapper around a call to crypto/tls.NewListener.
func (*BasicTLSListener) Accept ¶
func (b *BasicTLSListener) Accept() (net.Conn, error)
Accept implements net.Listener.
func (*BasicTLSListener) Addr ¶
func (b *BasicTLSListener) Addr() net.Addr
Addr implements net.Listener.
func (*BasicTLSListener) Close ¶
func (b *BasicTLSListener) Close() error
Close implements net.Listener.
func (*BasicTLSListener) UnmarshalJSON ¶
func (b *BasicTLSListener) UnmarshalJSON(d []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.
type PemConfig ¶
PemConfig implements a TlsCertificateGetter using a single PEM encoded key and certificate pair.
func (*PemConfig) GetCertificate ¶
func (p *PemConfig) GetCertificate( *tls.ClientHelloInfo, ) (*tls.Certificate, error)
GetCertificate implements TlsCertificateGetter.
func (*PemConfig) UnmarshalJSON ¶
UnmarshalJSON implements encoding/json.Unmarshaler.
type TLSCertificateGetter ¶
type TLSCertificateGetter interface {
GetCertificate(*tls.ClientHelloInfo) (*tls.Certificate, error)
}
TLSCertificateGetter provides a mechanism by which the assignment of the crypto/tls.Config.GetCertificate method can be abstracted independently from other aspects of the creation of the net.Listener returned from a call to crypto/tls.NewListener.