Documentation ¶
Index ¶
- func GenCertificate(dir string) (tls.Certificate, string, error)
- func GetCertFingerprint(cert []byte) string
- func NewServer(addr string, cert tls.Certificate, handler http.Handler) *http.Server
- func UrlPrefix(host string) string
- func WithAuth(auth Authorizer, next httprouter.Handle) httprouter.Handle
- func WithLogging(next http.Handler) http.Handler
- type Authorizer
- type AuthorizerFunc
- type Client
- type ErrUntrustedClient
- type ErrUntrustedServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenCertificate ¶
func GenCertificate(dir string) (tls.Certificate, string, error)
GenCertificate generates a new TLS certificate or loads it from disk. The fingerprint text file will be regenerated if it's missing. The cert will be regenerated if it and/or the private key are invalid or missing.
func GetCertFingerprint ¶
GetCertFingerprint returns the sha256 fingerprint of a PEM-encoded x509 certificate. The return values corresponds with the fingerprint return value of GenCertificate.
func UrlPrefix ¶
UrlPrefix returns the base URL used to reach the given coordinator host. The host can be specified as `hostname` or `hostname:port`. If port is not given, it will default to 8123 - the default listener port.
func WithAuth ¶
func WithAuth(auth Authorizer, next httprouter.Handle) httprouter.Handle
Types ¶
type Authorizer ¶
func TrustOneCert ¶
func TrustOneCert(finger string) Authorizer
type AuthorizerFunc ¶
func (AuthorizerFunc) TrustsCert ¶
func (a AuthorizerFunc) TrustsCert(fingerprint string) bool
type Client ¶
func NewClient ¶
func NewClient(cert tls.Certificate, timeout time.Duration, auth Authorizer) *Client
type ErrUntrustedClient ¶
type ErrUntrustedClient struct {
Fingerprint string
}
func (*ErrUntrustedClient) Error ¶
func (e *ErrUntrustedClient) Error() string
type ErrUntrustedServer ¶
type ErrUntrustedServer struct {
Fingerprint string
}
func (*ErrUntrustedServer) Error ¶
func (e *ErrUntrustedServer) Error() string
Click to show internal directories.
Click to hide internal directories.