Documentation ¶
Index ¶
- Constants
- func CtxDebug(ctx context.Context, format string, args ...interface{})
- func CtxError(ctx context.Context, format string, args ...interface{})
- func CtxInfo(ctx context.Context, format string, args ...interface{})
- func CtxWarn(ctx context.Context, format string, args ...interface{})
- func FastestPingIP(ipAddr []string, tcpPort int, timeout time.Duration) (string, int64, error)
- func FormatECS(r *dns.Msg) string
- func NewCtx(logger *logrus.Logger, logID uint16) context.Context
- func ParseECS(s string) (ecs *dns.EDNS0_SUBNET, err error)
- func PingIP(ipAddr string, tcpPort int, timeout time.Duration) error
- func RemoveA(resp *dns.Msg)
- func RemoveEDNSCookie(msg *dns.Msg)
- func SetDefaultECS(r *dns.Msg, ecs *dns.EDNS0_SUBNET)
- func WithFields(ctx context.Context, fields logrus.Fields) context.Context
- type FakeRespWriter
- func (w *FakeRespWriter) Close() error
- func (w *FakeRespWriter) Hijack()
- func (w *FakeRespWriter) LocalAddr() net.Addr
- func (w *FakeRespWriter) RemoteAddr() net.Addr
- func (w *FakeRespWriter) TsigStatus() error
- func (w *FakeRespWriter) TsigTimersOnly(bool)
- func (w *FakeRespWriter) Write(bytes []byte) (int, error)
- func (w *FakeRespWriter) WriteMsg(msg *dns.Msg) error
Constants ¶
View Source
const (
// RecHandleKey 是否被递归处理
RecHandleKey ctxKey = "TS_REC_HANDLE"
)
Variables ¶
This section is empty.
Functions ¶
func FastestPingIP ¶
FastestPingIP 向指定IP地址列表同时发起ping,返回ping值最低的IP地址和耗时
func ParseECS ¶
func ParseECS(s string) (ecs *dns.EDNS0_SUBNET, err error)
ParseECS 将字符串(IP/CIDR)转换为EDNS CLIENT SUBNET对象
func SetDefaultECS ¶
func SetDefaultECS(r *dns.Msg, ecs *dns.EDNS0_SUBNET)
SetDefaultECS 为DNS请求/响应设置默认的ECS对象
Types ¶
type FakeRespWriter ¶
func NewFakeRespWriter ¶
func NewFakeRespWriter() *FakeRespWriter
NewFakeRespWriter 创建一个FakeRespWriter,用于手动请求dns.Handler时获取DNS响应
func (*FakeRespWriter) Close ¶
func (w *FakeRespWriter) Close() error
func (*FakeRespWriter) Hijack ¶
func (w *FakeRespWriter) Hijack()
func (*FakeRespWriter) LocalAddr ¶
func (w *FakeRespWriter) LocalAddr() net.Addr
func (*FakeRespWriter) RemoteAddr ¶
func (w *FakeRespWriter) RemoteAddr() net.Addr
func (*FakeRespWriter) TsigStatus ¶
func (w *FakeRespWriter) TsigStatus() error
func (*FakeRespWriter) TsigTimersOnly ¶
func (w *FakeRespWriter) TsigTimersOnly(bool)
Click to show internal directories.
Click to hide internal directories.