ip

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = http.Client{
	Timeout: 5 * time.Second,
}

Functions

func ExternalIP

func ExternalIP() (string, error)

func InternalIP

func InternalIP() string

Types

type StringScorer

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

StringScorer is used to score successful connection requests. When getting the connection array next time, it prioritizes links with higher scores.

func NewStringScorer

func NewStringScorer(length int) *StringScorer

func (*StringScorer) AddScore

func (ss *StringScorer) AddScore(str string)

func (*StringScorer) All

func (ss *StringScorer) All() iter.Seq[string]

All returns an iterator over all strings in the scorer, ordered by score (highest first).

func (*StringScorer) AllWithScores

func (ss *StringScorer) AllWithScores() iter.Seq2[string, int]

AllWithScores returns an iterator over all string-score pairs in the scorer, ordered by score (highest first).

func (*StringScorer) Del

func (ss *StringScorer) Del(str string)

func (*StringScorer) Len

func (ss *StringScorer) Len() int

Len implements sort.Interface.

func (*StringScorer) Less

func (ss *StringScorer) Less(i int, j int) bool

Less implements sort.Interface.

func (*StringScorer) Set

func (ss *StringScorer) Set(str string) *StringScorer

func (*StringScorer) Swap

func (ss *StringScorer) Swap(i int, j int)

Swap implements sort.Interface.

Jump to

Keyboard shortcuts

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