utils

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TRACE level
	TRACE int = iota
	// DEBUG level
	DEBUG
	// INFO level
	INFO
	// WARNING level
	WARNING
	// ERROR level
	ERROR
)

Variables

This section is empty.

Functions

func Abs

func Abs(value int64) int64

Abs olute value

func GetBaseDomain

func GetBaseDomain(host string) string

GetBaseDomain from url

Types

type IPMatcher

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

IPMatcher - the matcher

func NewIPMatcher

func NewIPMatcher(enabled bool) *IPMatcher

NewIPMatcher creates new IP Matcher

func (*IPMatcher) Match

func (matcher *IPMatcher) Match(request *http.Request) string

Match tries to match real client IP address from request headers if enabled, otherwise returns an empty string

func (*IPMatcher) MatchHash added in v2.1.0

func (matcher *IPMatcher) MatchHash(request *http.Request) uint32

MatchHash returns the hash of matched IP, useful for cases when you need to separate one visitor from another without using identifying information

type Logger

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

Logger struct

func NewLogger

func NewLogger(prefix string, level string) *Logger

NewLogger creates new Logger object

func (Logger) Debug

func (l Logger) Debug(message string, args ...interface{})

Debug log

func (Logger) Error

func (l Logger) Error(message string, args ...interface{})

Error log

func (Logger) GetLog

func (l Logger) GetLog() *log.Logger

GetLog returns underlying Logger object, useful in cases where log.Logger required

func (Logger) Info

func (l Logger) Info(message string, args ...interface{})

Info log

func (Logger) Trace

func (l Logger) Trace(message string, args ...interface{})

Trace log

func (Logger) Warn

func (l Logger) Warn(message string, args ...interface{})

Warn log

type NetworkValidator added in v2.1.0

type NetworkValidator interface {
	HasA(host string) bool
	HasCNAME(host string) bool
	HasMX(host string) bool
}

NetworkValidator checks DNS entries

func NewNetworkValidator added in v2.1.0

func NewNetworkValidator(logLevel string) NetworkValidator

NewNetworkValidator object

Jump to

Keyboard shortcuts

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