relay

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: Apache-2.0 Imports: 30 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     model.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

	Stores Stores

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

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

func (*Server) Status added in v0.4.0

func (s *Server) Status(ctx context.Context) (Status, 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 Status added in v0.4.0

type Status struct {
	Status            statusc.Status  `json:"status"`
	Hostport          string          `json:"hostport"`
	ControlServerAddr string          `json:"control_server_addr"`
	ControlServerID   string          `json:"control_server_id"`
	Forwards          []model.Forward `json:"forwards"`
}

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

Jump to

Keyboard shortcuts

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