ipset

package module
v0.0.0-...-7836d59 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

README

ipset

ipset plugin for CoreDNS

中文简要使用说明,感谢@ioiioo

Example

.:53 {
        forward . 192.168.1.1
        ipset {
                twiroute api.twitter.com twitter.com dev.twitter.com www.twitter.com
                route2 domain1.net domain2.net domain3.net
        }
        ipset testroute1 testroute2 testroute3
        log
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AddIPCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "ipset",
		Name:      "add_ip_count_total",
		Help:      "Counter of add IP to ipset.",
	}, []string{"to"})
)

Variables declared for monitoring.

Functions

This section is empty.

Types

type N

type N struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

N implements the plugin interface.

func (N) Name

func (n N) Name() string

Name implements the Handler interface.

func (N) ServeDNS

func (n N) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

type ResponseReverter

type ResponseReverter struct {
	dns.ResponseWriter
	// contains filtered or unexported fields
}

ResponseReverter reverses the operations done on the question section of a packet. This is need because the client will otherwise disregards the response, i.e. dig will complain with ';; Question section mismatch: got example.org/HINFO/IN'

func NewResponseReverter

func NewResponseReverter(w dns.ResponseWriter, r *dns.Msg, listNames []string, mappedListName map[string][]string) *ResponseReverter

NewResponseReverter returns a pointer to a new ResponseReverter.

func (*ResponseReverter) HitDomainList

func (r *ResponseReverter) HitDomainList(domain string, domains []string) bool

func (*ResponseReverter) Write

func (r *ResponseReverter) Write(buf []byte) (int, error)

Write is a wrapper that records the size of the message that gets written.

func (*ResponseReverter) WriteMsg

func (r *ResponseReverter) WriteMsg(res *dns.Msg) error

WriteMsg records the status code and calls the underlying ResponseWriter's WriteMsg method.

Jump to

Keyboard shortcuts

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