doorway

package
v0.0.0-...-4219c0b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package doorway is the HTTP frontend on a shanhu instance.

Index

Constants

View Source
const HomeHost = "~"

HomeHost is the destination mapping that maps to doorway's internal administration server.

Variables

This section is empty.

Functions

func Main

func Main()

Main is the main entrance for doorway binary.

func Serve

func Serve(ctx C, config *Config) error

Serve serves doorway with the given config.

Types

type C

type C interface {
	context.Context
}

C is an alias to context.Context

type Config

type Config struct {
	// Server is the config for the http server.
	// This also includes the reverse proxy.
	Server *ServerConfig

	// TLSProxy is the configuration for the TLS proxy.
	TLSProxy *TLSProxyConfig

	// HTTPServer is the config for the http server part.
	HTTPServer *HTTPServerConfig

	// Local address to listen on.
	LocalAddr string

	Fabrics         *FabricsConfig // Config for dialing fabrics.
	FabricsIdentity Identity       // Identity for dialing fabrics.

	// Alternative fabrics dialer.
	FabricsDialer *fabdial.Dialer

	// TLSConfig is for the TLS config for serving the service via https.
	// If not specified, autocert from Letsencrypt will be used.
	TLSConfig *tls.Config

	// ListenDone is the callback function when listen is done.
	ListenDone func()
}

Config is the config of a doorway.

func ConfigFromHome

func ConfigFromHome(homeDir string) (*Config, error)

ConfigFromHome reads Config from the given directories.

type FabricsConfig

type FabricsConfig struct {
	User string
	Host string `json:",omitempty"` // Default using fabrics.homedrive.io

	InsecurelyDialTo string `json:",omitempty"`
}

FabricsConfig has the configuration for connecting HomeDrive Fabrics. This config is JSON marshallable.

type HTTPServerConfig

type HTTPServerConfig struct {
	// Address to listen on.
	Addr string

	// When the host is an IP or a ".local" address, forward to this service.
	LocalMapping string
}

HTTPServerConfig is the configuration for the http redirection service.

type Identity

type Identity interface {
	// Load loads the identity private key. Returns errcode.NotFound error
	// if key is not yet provisioned.
	Load(ctx context.Context) ([]byte, error)
}

Identity provides an identity for dialing fabrics.

func NewFileIdentity

func NewFileIdentity(f string) (Identity, error)

NewFileIdentity loads a private key from a file.

type ServerConfig

type ServerConfig struct {
	HostMap       map[string]string
	AutoCertCache autocert.Cache
	Home          aries.Service
	ManualCerts   map[string]*tls.Certificate

	IPWhitelist []string
}

ServerConfig is the config for serving the reverse proxy server.

type TLSProxyConfig

type TLSProxyConfig struct {
	// For these domains, forward the TCP connection directly.
	Forward map[string]string

	// Enables private mode. In private mode, unless listed
	// in PublicWhitelist, only connections for ACME ALPN challenges are
	// accepted.
	PrivateMode bool

	// Make these sites publicly accessible via fabrics.
	Public []string
}

TLSProxyConfig is the configuration for the TLS proxy.

Jump to

Keyboard shortcuts

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