relay

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: Apache-2.0 Imports: 37 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 {
	Endpoint model.Endpoint `json:"endpoint"`
	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 {
	ControlAddr  *net.UDPAddr
	ControlHost  string
	ControlToken string
	ControlCAs   *x509.CertPool

	Ingress []Ingress

	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 Ingress added in v0.8.0

type Ingress struct {
	Addr      *net.UDPAddr
	Hostports []model.HostPort
	Restr     restr.IP
}

type IngressBuilder added in v0.8.0

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

func NewIngressBuilder added in v0.8.0

func NewIngressBuilder() *IngressBuilder

func (*IngressBuilder) Error added in v0.8.0

func (b *IngressBuilder) Error() error

func (*IngressBuilder) Ingress added in v0.8.0

func (b *IngressBuilder) Ingress() (Ingress, error)

func (*IngressBuilder) WithAddr added in v0.8.0

func (b *IngressBuilder) WithAddr(addr *net.UDPAddr) *IngressBuilder

func (*IngressBuilder) WithAddrFrom added in v0.8.0

func (b *IngressBuilder) WithAddrFrom(addrStr string) *IngressBuilder

func (*IngressBuilder) WithHostport added in v0.8.0

func (b *IngressBuilder) WithHostport(hp model.HostPort) *IngressBuilder

func (*IngressBuilder) WithHostportFrom added in v0.8.0

func (b *IngressBuilder) WithHostportFrom(hostport string) *IngressBuilder

func (*IngressBuilder) WithHostports added in v0.8.0

func (b *IngressBuilder) WithHostports(hps []model.HostPort) *IngressBuilder

func (*IngressBuilder) WithRestr added in v0.8.0

func (b *IngressBuilder) WithRestr(iprestr restr.IP) *IngressBuilder

func (*IngressBuilder) WithRestrFrom added in v0.8.0

func (b *IngressBuilder) WithRestrFrom(allows []string, denies []string) *IngressBuilder

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 {
	Endpoint model.Endpoint `json:"endpoint"`
}

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"`
	Hostports         []string         `json:"hostports"`
	ControlServerAddr string           `json:"control_server_addr"`
	ControlServerID   string           `json:"control_server_id"`
	Endpoints         []model.Endpoint `json:"endpoints"`
}

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

type TransportsFn added in v0.8.0

type TransportsFn func(ctx context.Context) ([]*quic.Transport, error)

Jump to

Keyboard shortcuts

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