statute

package
v0.0.0-...-97adabc Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCFRanges = []string{
	"103.21.244.0/22",
	"103.22.200.0/22",
	"103.31.4.0/22",
	"104.16.0.0/12",
	"108.162.192.0/18",
	"131.0.72.0/22",
	"141.101.64.0/18",
	"162.158.0.0/15",
	"172.64.0.0/13",
	"173.245.48.0/20",
	"188.114.96.0/20",
	"190.93.240.0/20",
	"197.234.240.0/22",
	"198.41.128.0/17",
	"2400:cb00::/32",
	"2405:8100::/32",
	"2405:b500::/32",
	"2606:4700::/32",
	"2803:f800::/32",
	"2c0f:f248::/32",
	"2a06:98c0::/29",
}
View Source
var HTTPPing = 1 << 1
View Source
var QUICPing = 1 << 4
View Source
var TCPPing = 1 << 3
View Source
var TLSPing = 1 << 2
View Source
var WARPPing = 1 << 5

Functions

func CloneIP

func CloneIP(ip netip.Addr) netip.Addr

func DefaultDialerFunc

func DefaultDialerFunc(ctx context.Context, network, addr string) (net.Conn, error)

func DefaultHTTPClientFunc

func DefaultHTTPClientFunc(rawDialer TDialerFunc, tlsDialer TDialerFunc, quicDialer TQuicDialerFunc, targetAddr ...string) *http.Client

func DefaultIPQueueChangeCallback

func DefaultIPQueueChangeCallback(ips []IPInfo)

func DefaultQuicDialerFunc

func DefaultQuicDialerFunc(ctx context.Context, addr string, _ *tls.Config, _ *quic.Config) (quic.EarlyConnection, error)

func DefaultTLSDialerFunc

func DefaultTLSDialerFunc(ctx context.Context, network, addr string) (net.Conn, error)

DefaultTLSDialerFunc is a custom TLS dialer function

func IsIPv4

func IsIPv4(ip netip.Addr) bool

func IsIPv6

func IsIPv6(ip netip.Addr) bool

func TlsVersionToString

func TlsVersionToString(ver uint16) string

Types

type DefaultLogger

type DefaultLogger struct{}

func (DefaultLogger) Debug

func (l DefaultLogger) Debug(s string, v ...interface{})

func (DefaultLogger) Error

func (l DefaultLogger) Error(s string, v ...interface{})

type IPInfQueue

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

func (*IPInfQueue) Dequeue

func (q *IPInfQueue) Dequeue() IPInfo

Dequeue removes and returns the item with the lowest RTT.

func (*IPInfQueue) Enqueue

func (q *IPInfQueue) Enqueue(item IPInfo)

Enqueue adds an item and then sorts the queue.

func (*IPInfQueue) Size

func (q *IPInfQueue) Size() int

Size returns the number of items in the queue.

type IPInfo

type IPInfo struct {
	IP        netip.Addr
	RTT       int
	CreatedAt time.Time
}

type IPing

type IPing interface {
	Ping() IPingResult
	PingContext(context.Context) IPingResult
}

type IPingResult

type IPingResult interface {
	Result() int
	Error() error
	fmt.Stringer
}

type Logger

type Logger interface {
	Debug(s string, v ...interface{})
	Error(s string, v ...interface{})
}

type ScannerOptions

type ScannerOptions struct {
	UseIPv4               bool
	UseIPv6               bool
	CidrList              []string // CIDR ranges to scan
	SelectedOps           int
	Logger                Logger
	InsecureSkipVerify    bool
	RawDialerFunc         TDialerFunc
	TLSDialerFunc         TDialerFunc
	QuicDialerFunc        TQuicDialerFunc
	HttpClientFunc        THTTPClientFunc
	UseHTTP3              bool
	UseHTTP2              bool
	DisableCompression    bool
	HTTPPath              string
	Referrer              string
	UserAgent             string
	Hostname              string
	WarpPrivateKey        string
	WarpPeerPublicKey     string
	WarpPresharedKey      string
	Port                  uint16
	IPQueueSize           int
	IPQueueTTL            time.Duration
	MaxDesirableRTT       int
	IPQueueChangeCallback TIPQueueChangeCallback
	ConnectionTimeout     time.Duration
	HandshakeTimeout      time.Duration
	TlsVersion            uint16
}
var FinalOptions *ScannerOptions

type TDialerFunc

type TDialerFunc func(ctx context.Context, network, addr string) (net.Conn, error)

type THTTPClientFunc

type THTTPClientFunc func(rawDialer TDialerFunc, tlsDialer TDialerFunc, quicDialer TQuicDialerFunc, targetAddr ...string) *http.Client

type TIPQueueChangeCallback

type TIPQueueChangeCallback func(ips []IPInfo)

type TQuicDialerFunc

type TQuicDialerFunc func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error)

Jump to

Keyboard shortcuts

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