Documentation ¶
Overview ¶
Package horizon provides the implementation for Penne Horizons
Index ¶
- func MakeHorizons(conf []Config, res map[string]*resolver.Resolver, ...) ([]string, map[string]*Horizon, error)
- func NewContextKey(name string) *core.ContextKey[horizon.Match]
- type Config
- type Error
- type Horizon
- func (z *Horizon) Exchange(ctx context.Context, req *dns.Msg) (*dns.Msg, error)
- func (z *Horizon) HorizonExchange(ctx context.Context, req *dns.Msg) (*dns.Msg, error)
- func (z *Horizon) HorizonServeHTTP(rw http.ResponseWriter, req *http.Request)
- func (z *Horizon) New(h http.Handler, e resolver.Exchanger) *horizon.Horizon
- func (z *Horizon) ServeHTTP(rw http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeHorizons ¶
func MakeHorizons(conf []Config, res map[string]*resolver.Resolver, ctxKey *core.ContextKey[horizon.Match]) ([]string, map[string]*Horizon, error)
MakeHorizons builds Horizons from a Config slice, and prepares the resolvers to get back to us when they don't know what else to do.
func NewContextKey ¶
func NewContextKey(name string) *core.ContextKey[horizon.Match]
NewContextKey returns a core.ContextKey to be used to store the horizon.Match in horizon.Horizons
Types ¶
type Config ¶
type Config struct { Name string `yaml:"name"` Next string `yaml:"next,omitempty" toml:",omitempty" json:",omitempty"` AllowForwarding bool `yaml:"allow_forwarding,omitempty" toml:",omitempty" json:",omitempty"` Networks []netip.Prefix `yaml:"networks,omitempty" toml:",omitempty" json:",omitempty"` Resolver string `yaml:"resolver,omitempty" toml:",omitempty" json:",omitempty"` }
Config describes a Horizon
type Horizon ¶
type Horizon struct {
// contains filtered or unexported fields
}
A Horizon is a [resolver.Exchanger] for a particular set of networks
func (*Horizon) Exchange ¶ added in v0.0.4
Exchange handles DNS requests passed from another Horizon.
func (*Horizon) HorizonExchange ¶ added in v0.0.4
HorizonExchange handles DNS requests directly from the dns.Server when the client belongs in the range.
A Horizon that acts as entry point has to make sure security constraints are checked.
func (*Horizon) HorizonServeHTTP ¶ added in v0.0.4
func (z *Horizon) HorizonServeHTTP(rw http.ResponseWriter, req *http.Request)
HorizonServeHTTP handles HTTP requests directly from the http.Server when the client belongs in the range.
A Horizon that acts as entry point has to make sure security constraints are checked.
func (*Horizon) New ¶ added in v0.0.4
New creates an assembled horizon.Horizon