utils

package
v0.0.0-...-07f90b3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_GROUP_NAME = "default"

Variables

View Source
var (
	ErrTypeNotSupport = errors.New("type not support")
	ErrIPInvalid      = errors.New("invalid IP address")
)
View Source
var DEFAULT_DOMAIN_NAMES []string = []string{"", "home", "local"}

Functions

func ConvertKeyToId

func ConvertKeyToId(key string) string

func FilterUDPAddrListByValue

func FilterUDPAddrListByValue(list []net.UDPAddr, value string) []net.UDPAddr

func GenericListContainItem

func GenericListContainItem(elem interface{}, elems []interface{}) bool

func IsDefaultGroupDomain

func IsDefaultGroupDomain(domain string) bool

func NtToString

func NtToString(rName dnsmessage.Name, rType dnsmessage.Type) string

resource name and type to string

func PToString

func PToString(p model.Packet) string

packet to string

func QToString

func QToString(q dnsmessage.Question) string

question to string

func RToString

func RToString(r dnsmessage.Resource) string

resource to string

func RemoveDuplicatesInResourceList

func RemoveDuplicatesInResourceList(l []dnsmessage.Resource) []dnsmessage.Resource

func RemoveDuplicatesInUpdAddrList

func RemoveDuplicatesInUpdAddrList(l []net.UDPAddr) []net.UDPAddr

func ReplaceQuestionUnrelated

func ReplaceQuestionUnrelated(val string) (string, error)

func ResourceToString

func ResourceToString(a1 dnsmessage.Resource) string

func RestParseRequest

func RestParseRequest(w http.ResponseWriter, r *http.Request, res interface{}) error

func RestParseResponse

func RestParseResponse(w http.ResponseWriter, r *http.Request, req interface{}) error

func SplitDomainsFromHostname

func SplitDomainsFromHostname(hostName string) []string

func StringsListContainItem

func StringsListContainItem(elem string, elems []string, ignoreCase bool) bool

func ToRType

func ToRType(sType string) dnsmessage.Type

func ToRecordData

func ToRecordData(req model.Request) (string, string, net.IP, string, dnsmessage.Resource, error)

func ToResource

func ToResource(req model.Request) (dnsmessage.Resource, error)

func ToResourceHeader

func ToResourceHeader(name string, sType string) (h dnsmessage.ResourceHeader, err error)

func UDPAddrListContainsValue

func UDPAddrListContainsValue(list []net.UDPAddr, value string) bool

func UpdAddrToString

func UpdAddrToString(a1 net.UDPAddr) string

Types

type FileIndex

type FileIndex struct {
	Path  string
	Size  int64
	Index int
}

func FileToIndex

func FileToIndex(path string, extension string) (FileIndex, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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