control

package
v0.0.0-...-8871cbf Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientAuthentication

type ClientAuthentication interface {
	Validate(fwd model.Forward, role model.Role) (model.Forward, error)

	encoding.BinaryMarshaler
}

type ClientAuthenticator

type ClientAuthenticator interface {
	Authenticate(token string) (ClientAuthentication, error)
}

type ClientConnKey

type ClientConnKey struct {
	ID ksuid.KSUID `json:"id"`
}

type ClientConnValue

type ClientConnValue struct {
	Authentication []byte `json:"authentication"`
	Addr           string `json:"addr"`
}

type ClientPeerKey

type ClientPeerKey struct {
	Forward model.Forward `json:"forward"`
	Role    model.Role    `json:"role"`
	ID      ksuid.KSUID   `json:"id"` // TODO consider using the server cert key
}

type ClientPeerValue

type ClientPeerValue struct {
	Peer *pbs.ClientPeer `json:"peer"`
}

type ClientRelays

type ClientRelays interface {
	Client(ctx context.Context, fwd model.Forward, role model.Role, cert *x509.Certificate,
		notify func(map[ksuid.KSUID]relayCacheValue) error) error
}

type Config

type Config struct {
	Addr       *net.UDPAddr
	Cert       tls.Certificate
	ClientAuth ClientAuthenticator
	RelayAuth  RelayAuthenticator
	Stores     Stores
	Logger     *slog.Logger
}

type ConfigKey

type ConfigKey string

type ConfigValue

type ConfigValue struct {
	Int64  int64  `json:"int64,omitempty"`
	String string `json:"string,omitempty"`
	Bytes  []byte `json:"bytes,omitempty"`
}

type RelayAuthentication

type RelayAuthentication interface {
	Allow(fwd model.Forward) bool

	encoding.BinaryMarshaler
}

type RelayAuthenticator

type RelayAuthenticator interface {
	Authenticate(token string) (RelayAuthentication, error)
}

type RelayClientKey

type RelayClientKey struct {
	Forward model.Forward `json:"forward"`
	Role    model.Role    `json:"role"`
	Key     certc.Key     `json:"key"`
}

type RelayClientValue

type RelayClientValue struct {
	Cert *x509.Certificate `json:"cert"`
}

func (RelayClientValue) MarshalJSON

func (v RelayClientValue) MarshalJSON() ([]byte, error)

func (*RelayClientValue) UnmarshalJSON

func (v *RelayClientValue) UnmarshalJSON(b []byte) error

type RelayConnKey

type RelayConnKey struct {
	ID ksuid.KSUID `json:"id"`
}

type RelayConnValue

type RelayConnValue struct {
	Authentication []byte         `json:"authentication"`
	Hostport       model.HostPort `json:"hostport"`
}

type RelayForwardKey

type RelayForwardKey struct {
	Forward model.Forward `json:"forward"`
}

type RelayForwardValue

type RelayForwardValue struct {
	Cert *x509.Certificate `json:"cert"`
}

func (RelayForwardValue) MarshalJSON

func (v RelayForwardValue) MarshalJSON() ([]byte, error)

func (*RelayForwardValue) UnmarshalJSON

func (v *RelayForwardValue) UnmarshalJSON(b []byte) error

type RelayServerKey

type RelayServerKey struct {
	Forward model.Forward `json:"forward"`
	RelayID ksuid.KSUID   `json:"relay_id"`
}

type RelayServerValue

type RelayServerValue struct {
	Hostport model.HostPort    `json:"hostport"`
	Cert     *x509.Certificate `json:"cert"`
}

func (RelayServerValue) MarshalJSON

func (v RelayServerValue) MarshalJSON() ([]byte, error)

func (*RelayServerValue) UnmarshalJSON

func (v *RelayServerValue) UnmarshalJSON(b []byte) error

type Server

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

func NewServer

func NewServer(cfg Config) (*Server, error)

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

type Stores

type Stores interface {
	Config() (logc.KV[ConfigKey, ConfigValue], error)

	ClientConns() (logc.KV[ClientConnKey, ClientConnValue], error)
	ClientPeers() (logc.KV[ClientPeerKey, ClientPeerValue], error)

	RelayConns() (logc.KV[RelayConnKey, RelayConnValue], error)
	RelayClients() (logc.KV[RelayClientKey, RelayClientValue], error)
	RelayForwards(id ksuid.KSUID) (logc.KV[RelayForwardKey, RelayForwardValue], error)
	RelayServers() (logc.KV[RelayServerKey, RelayServerValue], error)
	RelayServerOffsets() (logc.KV[RelayConnKey, int64], error)
}

func NewFileStores

func NewFileStores(dir string) Stores

func NewTmpFileStores

func NewTmpFileStores() (Stores, error)

Jump to

Keyboard shortcuts

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