common

package
v0.0.0-...-4829b00 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package common provides common functions.

Index

Constants

This section is empty.

Variables

View Source
var ReservedIPNetworkList = getReservedIPNetworkList()

Functions

func FindRecordByType

func FindRecordByType(msg *dns.Msg, t uint16) string

func GetEDNSClientSubnetIP

func GetEDNSClientSubnetIP(m *dns.Msg) string

func HasAnswer

func HasAnswer(m *dns.Msg) bool

func HasSubDomain

func HasSubDomain(s string, sub string) bool

func IsDomainMatchRule

func IsDomainMatchRule(pattern string, domain string) bool

func IsEDNSClientSubnet

func IsEDNSClientSubnet(o *dns.OPT) *dns.EDNS0_SUBNET

func SetEDNSClientSubnet

func SetEDNSClientSubnet(m *dns.Msg, ip string, isNoCookie bool)

func SetMinimumTTL

func SetMinimumTTL(msg *dns.Msg, minimumTTL uint32)

func SetTTLByMap

func SetTTLByMap(msg *dns.Msg, domainTTLMap map[string]uint32)

Types

type DNSUpstream

type DNSUpstream struct {
	Name             string                `yaml:"name" json:"name"`
	Address          string                `yaml:"address" json:"address"`
	Protocol         string                `yaml:"protocol" json:"protocol"`
	SOCKS5Address    string                `yaml:"socks5Address" json:"socks5Address"`
	Timeout          int                   `yaml:"timeout" json:"timeout"`
	EDNSClientSubnet *EDNSClientSubnetType `yaml:"ednsClientSubnet" json:"ednsClientSubnet"`
	TCPPoolConfig    struct {
		Enable          bool `yaml:"enable" json:"enable"`
		InitialCapacity int  `yaml:"initialCapacity" json:"initialCapacity"`
		MaxCapacity     int  `yaml:"maxCapacity" json:"maxCapacity"`
		IdleTimeout     int  `yaml:"idleTimeout" json:"idleTimeout"`
	} `yaml:"tcpPoolConfig" json:"tcpPoolConfig"`
}

type EDNSClientSubnetType

type EDNSClientSubnetType struct {
	Policy     string `yaml:"policy" json:"policy"`
	ExternalIP string `yaml:"externalIP" json:"externalIP"`
	NoCookie   bool   `yaml:"noCookie"json:"noCookie"`
}

type IPSet

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

func NewIPSet

func NewIPSet(ipNetList []*net.IPNet) *IPSet

func (*IPSet) Contains

func (ipSet *IPSet) Contains(ip net.IP, isLog bool, name string) bool

Jump to

Keyboard shortcuts

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