config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name string `yaml:"name"` // IPAddress or DNSName
	Port int    `yaml:"port"`
}

type DNSProtocol

type DNSProtocol string
const (
	DNSProtocolSYS  DNSProtocol = "sys"
	DNSProtocolUDP  DNSProtocol = "udp"
	DNSProtocolTCP  DNSProtocol = "tcp"
	DNSProtocolDOH  DNSProtocol = "doh"
	DNSProtocolQUIC DNSProtocol = "quic"
)

type DNSResolver

type DNSResolver struct {
	Protocol DNSProtocol
	Servers  []string
}

type EndpointConfig

type EndpointConfig struct {
	Name        string  `yaml:"endpoint"`
	Description string  `yaml:"description"`
	HopChain    string  `yaml:"hopChain"`
	TargetUrl   string  `yaml:"target"`
	FingerPrint *string `yaml:"thumbNail"`
}

type FlatHopChains

type FlatHopChains struct {
	Name string   `yaml:"name"`
	Hops []string `yaml:"hops"` // reference hops by name
}

type FlatNetConfig

type FlatNetConfig struct {
	BaseDomain  string `yaml:"baseDomain"`
	DNSProvider string `yaml:"dnsProvider"`
	Description string `yaml:"description,omitempty"`
	DNSResolver DNSResolver
	Hops        map[string]Hop            `yaml:"hops,omitempty"`
	HopChains   map[string]FlatHopChains  `yaml:"hopChains,omitempty"`
	Endpoints   map[string]EndpointConfig `yaml:"endpoints,omitempty"`
}

type Hop

type Hop struct {
	Role        HopRole     `yaml:"role"`
	Name        string      `yaml:"name"`
	Listen      HopListen   `yaml:"listen"`
	DNSResolver DNSResolver `yaml:"dnsResolver"`
}

type HopChains

type HopChains struct {
	Name string `yaml:"name"`
	Hops []*Hop `yaml:"hops"` // reference hops by name
}

type HopListen

type HopListen struct {
	Protocol  HopProtocol `yaml:"protocol"`
	Key       string      `yaml:"key"`  // pem or secretRef:keyName
	Cert      string      `yaml:"cert"` // pem or secretRef:keyName
	Local     Address     `yaml:"local"`
	Externals []Address   `yaml:"externals"`
}

type HopProtocol

type HopProtocol string
const (
	HTTP3 HopProtocol = "http3"
	HTTPS HopProtocol = "https"
)

type HopRole

type HopRole string
const (
	EntryPoint  HopRole = "entrypoint"  // The first hop in the chain
	EntryFanout HopRole = "entryfanout" // The first hop in the chain that forwards directly
	Relay       HopRole = "Relay"       // A hop that Relays to a Relay or a Fanout
	Fanout      HopRole = "fanout"      // A hop that forwards to multiple other hops
)

type KeyFileResolver

type KeyFileResolver struct{}

func (*KeyFileResolver) Resolve

func (kfr *KeyFileResolver) Resolve(name string) (key string, err error)

type KeyResolver

type KeyResolver interface {
	Resolve(name string) (key string, err error)
}

type NetConfig

type NetConfig struct {
	BaseDomain  string `yaml:"baseDomain"`
	DNSProvider string `yaml:"dnsProvider"`
	DNSResolver DNSResolver
	Description string                    `yaml:"description,omitempty"`
	Hops        map[string]Hop            `yaml:"hops,omitempty"`
	HopChains   map[string]HopChains      `yaml:"hopChains,omitempty"`
	Endpoints   map[string]EndpointConfig `yaml:"endpoints,omitempty"`
}

func NewNetConfigFromYaml

func NewNetConfigFromYaml(yamlData []byte, krs ...KeyResolver) (nc NetConfig, err error)

Jump to

Keyboard shortcuts

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