webservice

package
v0.0.6-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_CLIENT_TIMEOUT       = 10 * time.Second
	HTTP_SERVER_READ_TIMEOUT  = 5 * time.Second
	HTTP_SERVER_WRITE_TIMEOUT = 30 * time.Second
	HTTP_SERVER_IDLE_TIMEOUT  = 120 * time.Second
)

Variables

View Source
var (
	DefaultConfig = v1.Config{
		Home: "public_html",
		Port: 8080,
		JWT: v1.JWT{
			Expiration: 525960,
		},
		TLSPort: 8443,
		Certificate: v1.Identity{
			Valid: 365,
			Subject: ca.Subject{
				CommonName:         "www.example.com",
				Organization:       "Trusted Platform",
				OrganizationalUnit: "IoT",
				Country:            "USA",
				Province:           "Kernel",
				Locality:           "Hypervisor",
				Address:            "123 Example Street",
				PostalCode:         "12345",
			},
			SANS: &ca.SubjectAlternativeNames{
				DNS: []string{
					"www.example.com",
					"localhost",
					"localhost.localdomain",
				},
				IPs: []string{
					"127.0.0.1",
				},
				Email: []string{
					"root@localhost",
					"root@localhost.localdomain",
				},
			},
		},
	}

	DefaultConfigRSA     = DefaultConfig
	DefaultConfigECDSA   = DefaultConfig
	DefaultConfigEd25519 = DefaultConfig
)
View Source
var (
	ErrLoadTlsCerts = errors.New("webserver: unable to load TLS certificates")
	ErrBindPort     = errors.New("webserver: unable to bind to web service port")
)

Functions

This section is empty.

Types

type LoadBalancerFunc

type LoadBalancerFunc func(backends []string) string

func RoundRobinBalancer

func RoundRobinBalancer() LoadBalancerFunc

type MutualTLSClient

type MutualTLSClient struct {
	// contains filtered or unexported fields
}

func NewMutalTLSClient

func NewMutalTLSClient(
	logger *logging.Logger,
	ca ca.CertificateAuthority,
	attrs *keystore.KeyAttributes) MutualTLSClient

func (MutualTLSClient) Get

func (client MutualTLSClient) Get(url string) ([]byte, error)

Performs an HTTP GET request

type Signer

type Signer struct {
	crypto.Signer
	// contains filtered or unexported fields
}

func NewSigner

func NewSigner(
	logger *logging.Logger,
	ca ca.CertificateAuthority,
	cert *x509.Certificate,
	cn string,
	password []byte) *Signer

func (*Signer) Public

func (signer *Signer) Public() crypto.PublicKey

func (*Signer) Sign

func (signer *Signer) Sign(
	rand io.Reader,
	digest []byte,
	opts crypto.SignerOpts) ([]byte, error)

type WebServerV1

type WebServerV1 struct {
	// contains filtered or unexported fields
}

func NewWebServerV1

func NewWebServerV1(
	debug bool,
	logger *logging.Logger,
	_ca ca.CertificateAuthority,
	config *v1.Config,
	restServiceRegistry v1.RestHandlerRegistry,
	keyAttributes *keystore.KeyAttributes) *WebServerV1

func (*WebServerV1) Run

func (server *WebServerV1) Run()

Starts the web server

func (*WebServerV1) Shutdown

func (server *WebServerV1) Shutdown()

Shutdown the web server

Directories

Path Synopsis
v1
jwt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL