Documentation ¶
Index ¶
- Variables
- func SetMiddleware(m Middleware)
- type APIConfig
- type AddonsConfig
- type CacheConfig
- type ClientLimiterConfig
- type Config
- type DomainSetConfig
- type ECSConfig
- type HttpConfig
- type LimiterConfig
- type LogConfig
- type Middleware
- type QueryInfo
- type QueryMeta
- type QuicConfig
- type RespMeta
- type RespWriter
- type Router
- type RuleConfig
- type ServerConfig
- type SocketConfig
- type TcpConfig
- type TlsConfig
- type UdpConfig
- type UpstreamConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrConcurrentReload = errors.New("concurrent reloading call")
)
Functions ¶
func SetMiddleware ¶
func SetMiddleware(m Middleware)
Types ¶
type AddonsConfig ¶
type AddonsConfig struct{}
type CacheConfig ¶
type ClientLimiterConfig ¶
type Config ¶
type Config struct { Servers []ServerConfig `yaml:"servers"` Upstreams []UpstreamConfig `yaml:"upstreams"` DomainSets []DomainSetConfig `yaml:"domain_sets"` Rules []RuleConfig `yaml:"rules"` Addons AddonsConfig `yaml:"addons"` Log LogConfig `yaml:"log"` Cache CacheConfig `yaml:"cache"` ECS ECSConfig `yaml:"ecs"` Limiter LimiterConfig `yaml:"limiter"` API APIConfig `yaml:"api"` }
type DomainSetConfig ¶
type HttpConfig ¶
type LimiterConfig ¶
type LimiterConfig struct { GlobalLimit int `yaml:"global_limit"` Client ClientLimiterConfig `yaml:"client"` }
type Middleware ¶
type Middleware interface { // Handle query msg right after receiving. // Note: This func should be fast and MUST NOT contain block operations. It will // be called directly in the main network thread in UDP/Gnet server. PreHandling(m *dnsmsg.Msg, qMeta QueryMeta) (resp *dnsmsg.Msg, err error) // Handle query msg before sending to upstream. PreForwarding(ctx context.Context, m *dnsmsg.Msg, qMeta QueryMeta, qInfo QueryInfo) (resp *dnsmsg.Msg, err error) // Handle query and response after received from upstream. PostForwarding(ctx context.Context, q *dnsmsg.Question, qMeta QueryMeta, qInfo QueryInfo, resp *dnsmsg.Msg) error }
type QueryInfo ¶
type QueryInfo struct { Id uint16 OpCode dnsmsg.OpCode Rd bool // RecursionDesired EDNS0 bool // Has EDNS0 section ECS netip.Prefix // EDNS0 Client subnet }
Query info.
type QueryMeta ¶
type QueryMeta struct { RemoteAddr netip.AddrPort // client addr, maybe invalid LocalAddr netip.AddrPort // inbound/server addr, maybe invalid }
Query meta data from server side.
type QuicConfig ¶
type QuicConfig struct {
MaxStreams int64 `yaml:"max_streams"`
}
type RespWriter ¶
type RuleConfig ¶
type ServerConfig ¶
type ServerConfig struct { Tag string `yaml:"tag"` Protocol string `yaml:"protocol"` Listen string `yaml:"listen"` IdleTimeout int `yaml:"idle_timeout"` Udp UdpConfig `yaml:"udp"` Tcp TcpConfig `yaml:"tcp"` Tls TlsConfig `yaml:"tls"` Http HttpConfig `yaml:"http"` Quic QuicConfig `yaml:"quic"` Socket SocketConfig `yaml:"socket"` }
type SocketConfig ¶
type SocketConfig struct { SO_REUSEPORT bool `yaml:"so_reuseport"` // tcp/udp SO_RCVBUF int `yaml:"so_rcvbuf"` SO_SNDBUF int `yaml:"so_sndbuf"` SO_MARK int `yaml:"so_mark"` SO_BINDTODEVICE string `yaml:"so_bindtodevice"` // contains filtered or unexported fields }
Only support linux.
type UpstreamConfig ¶
type UpstreamConfig struct { Tag string `yaml:"tag"` Addr string `yaml:"addr"` DialAddr string `yaml:"dial_addr"` Tls TlsConfig `yaml:"tls"` Socket SocketConfig `yaml:"socket"` }
Source Files ¶
- api.go
- cache.go
- config.go
- context.go
- domain_set.go
- ecs.go
- limiter.go
- log.go
- metrics.go
- reloader.go
- router.go
- router_handle.go
- router_middleware.go
- rule.go
- server_http.go
- server_http_fasthttp.go
- server_http_gohttp.go
- server_quic.go
- server_tcp.go
- server_tcp_gnet_linux.go
- server_udp.go
- server_utils.go
- sever.go
- signal_linux.go
- socket_ctl.go
- socket_ctl_linux.go
- tls.go
- upstream.go
- utils.go
Click to show internal directories.
Click to hide internal directories.