listener

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: GPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIdleTimeout   = 60 * time.Second
	DefaultDealTimeout   = 20 * time.Second
	DefaultMaxConnection = 256
)
View Source
const (
	HTTPListenerType        = "http"
	HTTPListenerDefaultPath = "/dns-query"
)
View Source
const (
	UDPListenerType  = "udp"
	UDPMaxBufferSize = 4096
)
View Source
const QUICListenerType = "quic"
View Source
const TCPListenerType = "tcp"
View Source
const TLSListenerType = "tls"

Variables

This section is empty.

Functions

func NewHTTPListener

func NewHTTPListener(ctx context.Context, core adapter.Core, logger log.Logger, tag string, options HTTPListenerOptions, workflow string) (adapter.Listener, error)

func NewListener

func NewListener(ctx context.Context, core adapter.Core, logger log.Logger, tag string, options Options) (adapter.Listener, error)

func NewQUICListener

func NewQUICListener(ctx context.Context, core adapter.Core, logger log.Logger, tag string, options QUICListenerOptions, workflow string) (adapter.Listener, error)

func NewTCPListener

func NewTCPListener(ctx context.Context, core adapter.Core, logger log.Logger, tag string, options TCPListenerOptions, workflow string) (adapter.Listener, error)

func NewTLSListener

func NewTLSListener(ctx context.Context, core adapter.Core, logger log.Logger, tag string, options TLSListenerOptions, workflow string) (adapter.Listener, error)

func NewUDPListener

func NewUDPListener(ctx context.Context, core adapter.Core, logger log.Logger, tag string, options UDPListenerOptions, workflow string) (adapter.Listener, error)

Types

type GenericListener

type GenericListener struct {
	adapter.Listener
	// contains filtered or unexported fields
}

func (*GenericListener) Close

func (l *GenericListener) Close() error

func (*GenericListener) Handle

func (l *GenericListener) Handle(ctx context.Context, req *dns.Msg, clientAddr netip.AddrPort) *dns.Msg

func (*GenericListener) Start

func (l *GenericListener) Start() error

type HTTPListener

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

func (*HTTPListener) Close

func (l *HTTPListener) Close() error

func (*HTTPListener) Handle

func (l *HTTPListener) Handle(ctx context.Context, req *dns.Msg, clientAddr netip.AddrPort) *dns.Msg

func (*HTTPListener) ServeHTTP

func (l *HTTPListener) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HTTPListener) Start

func (l *HTTPListener) Start() error

func (*HTTPListener) Tag

func (l *HTTPListener) Tag() string

func (*HTTPListener) Type

func (l *HTTPListener) Type() string

type HTTPListenerOptions

type HTTPListenerOptions struct {
	Listen       string                 `yaml:"listen"`
	Path         string                 `yaml:"path"`
	ReadIPHeader string                 `yaml:"read-ip-header,omitempty"`
	TrustIP      utils.Listable[string] `yaml:"trust-ip,omitempty"`
	UseHTTP3     bool                   `yaml:"use-http3,omitempty"`
	Enable0RTT   bool                   `yaml:"enable-0rtt,omitempty"`
	TLSOptions   *TLSOptions            `yaml:",inline,omitempty"`
}

type Options

type Options struct {
	Tag         string
	Type        string
	DealTimeout time.Duration
	Workflow    string

	UDPOptions  *UDPListenerOptions
	TCPOptions  *TCPListenerOptions
	TLSOptions  *TLSListenerOptions
	HTTPOptions *HTTPListenerOptions
	QUICOptions *QUICListenerOptions
}

func (*Options) UnmarshalYAML

func (o *Options) UnmarshalYAML(unmarshal func(interface{}) error) error

type QUICListener

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

func (*QUICListener) Close

func (l *QUICListener) Close() error

func (*QUICListener) Handle

func (l *QUICListener) Handle(ctx context.Context, req *dns.Msg, clientAddr netip.AddrPort) *dns.Msg

func (*QUICListener) Start

func (l *QUICListener) Start() error

func (*QUICListener) Tag

func (l *QUICListener) Tag() string

func (*QUICListener) Type

func (l *QUICListener) Type() string

type QUICListenerOptions

type QUICListenerOptions struct {
	Listen        string         `yaml:"listen"`
	IdleTimeout   utils.Duration `yaml:"idle-timeout,omitempty"`
	MaxConnection int            `yaml:"max-connection,omitempty"`
	Enable0RTT    bool           `yaml:"enable-0rtt,omitempty"`
	TLSOptions    TLSOptions     `yaml:",inline,omitempty"`
}

type TCPListener

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

func (*TCPListener) Close

func (l *TCPListener) Close() error

func (*TCPListener) Handle

func (l *TCPListener) Handle(ctx context.Context, req *dns.Msg, clientAddr netip.AddrPort) *dns.Msg

func (*TCPListener) Start

func (l *TCPListener) Start() error

func (*TCPListener) Tag

func (l *TCPListener) Tag() string

func (*TCPListener) Type

func (l *TCPListener) Type() string

type TCPListenerOptions

type TCPListenerOptions struct {
	Listen        string         `yaml:"listen"`
	IdleTimeout   utils.Duration `yaml:"idle-timeout,omitempty"`
	MaxConnection int            `yaml:"max-connection,omitempty"`
}

type TLSListener

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

func (*TLSListener) Close

func (l *TLSListener) Close() error

func (*TLSListener) Handle

func (l *TLSListener) Handle(ctx context.Context, req *dns.Msg, clientAddr netip.AddrPort) *dns.Msg

func (*TLSListener) Start

func (l *TLSListener) Start() error

func (*TLSListener) Tag

func (l *TLSListener) Tag() string

func (*TLSListener) Type

func (l *TLSListener) Type() string

type TLSListenerOptions

type TLSListenerOptions struct {
	Listen        string         `yaml:"listen"`
	IdleTimeout   utils.Duration `yaml:"idle-timeout,omitempty"`
	MaxConnection int            `yaml:"max-connection,omitempty"`
	TLSOptions    TLSOptions     `yaml:",inline,omitempty"`
}

type TLSOptions

type TLSOptions struct {
	ClientCAFile   utils.Listable[string] `yaml:"client-ca-file,omitempty"`
	ServerCertFile string                 `yaml:"server-cert-file,omitempty"`
	ServerKeyFile  string                 `yaml:"server-key-file,omitempty"`
}

type UDPListener

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

func (*UDPListener) Close

func (l *UDPListener) Close() error

func (*UDPListener) Handle

func (l *UDPListener) Handle(ctx context.Context, req *dns.Msg, clientAddr netip.AddrPort) *dns.Msg

func (*UDPListener) Start

func (l *UDPListener) Start() error

func (*UDPListener) Tag

func (l *UDPListener) Tag() string

func (*UDPListener) Type

func (l *UDPListener) Type() string

type UDPListenerOptions

type UDPListenerOptions struct {
	Listen        string `yaml:"listen"`
	MaxConnection int    `yaml:"max-connection,omitempty"`
}

Jump to

Keyboard shortcuts

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