ipset

package module
v0.0.0-...-c8c896b Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: GPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
}

On macOS, ipset writes directly to /dev/pf through github.com/leiless/dnsredir/pf. Run CoreDNS with permission to open /dev/pf; building requires CGO and the PF headers described in dnsredir's pf/download-pf-headers.sh. Use NAME:ANCHOR to select an anchored table, for example:

ipset {
    direct_cidr:com.apple/climbovergui example.com
}

Tables must already exist. Duplicate addresses are handled by PF, and shutdown does not flush tables owned by other applications.

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
⌂ 换网址