relay

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientKey

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

type ClientValue

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

func (ClientValue) MarshalJSON

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

func (*ClientValue) UnmarshalJSON

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

type Config

type Config struct {
	Addr     *net.UDPAddr
	Hostport model.HostPort
	Logger   *slog.Logger
	Stores   Stores

	ControlAddr  *net.UDPAddr
	ControlHost  string
	ControlToken string
	ControlCAs   *x509.CertPool
}

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 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 ServerKey

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

type ServerValue

type ServerValue struct {
	Name    string                          `json:"name"`
	Cert    *certc.Cert                     `json:"cert"`
	Clients map[serverClientKey]ClientValue `json:"clients"`
}

func (ServerValue) MarshalJSON

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

func (*ServerValue) UnmarshalJSON

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

type Stores

type Stores interface {
	Config() (logc.KV[ConfigKey, ConfigValue], error)
	Clients() (logc.KV[ClientKey, ClientValue], error)
	Servers() (logc.KV[ServerKey, ServerValue], 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