ipset

package module
v0.0.0-...-3441de9 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 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

syntax

包含.baidu.com,.126.com并排除.ad.baidu.com

ipset ipset_list { include .baidu.com .126.com exclude .ad.baidu.com }

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 DotSegmentIterator

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

func NewDotSegmentRevertIterator

func NewDotSegmentRevertIterator(value string) *DotSegmentIterator

func (*DotSegmentIterator) HasNext

func (iterator *DotSegmentIterator) HasNext() bool

func (*DotSegmentIterator) Next

func (iterator *DotSegmentIterator) Next() int

func (*DotSegmentIterator) NextIdx

func (iterator *DotSegmentIterator) NextIdx() int

type IPSet

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

IPSet implements the plugin interface.

func New

func New() *IPSet

New create new ipset

func (IPSet) Name

func (p IPSet) Name() string

Name implements the Handler interface.

func (IPSet) ServeDNS

func (p IPSet) 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, ipset *IPSet) *ResponseReverter

NewResponseReverter returns a pointer to a new ResponseReverter.

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.

type StringSegment

type StringSegment func(key string, start int) (segment string, nextIndex int)

type Trie

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

func NewTrie

func NewTrie(key string) *Trie

func (*Trie) Get

func (trie *Trie) Get(key string) int

func (*Trie) Put

func (trie *Trie) Put(key string, value int)

Jump to

Keyboard shortcuts

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