fakeip

package
v0.0.0-...-17b02d1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	IPNet netip.Prefix
	Host  []C.DomainMatcher
	Mode  C.FilterMode

	// Size sets the maximum number of entries in memory
	// and does not work if Persistence is true
	Size int

	// Persistence will save the data to disk.
	// Size will not work and record will be fully stored.
	Persistence bool
}

type Pool

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

Pool is an implementation about fake ip generator without storage

func New

func New(options Options) (*Pool, error)

New return Pool instance

func (*Pool) Broadcast

func (p *Pool) Broadcast() netip.Addr

Broadcast return the last ip

func (*Pool) CloneFrom

func (p *Pool) CloneFrom(o *Pool)

CloneFrom clone cache from old pool

func (*Pool) Exist

func (p *Pool) Exist(ip netip.Addr) bool

Exist returns if given ip exists in fake-ip pool

func (*Pool) FlushFakeIP

func (p *Pool) FlushFakeIP() error

func (*Pool) Gateway

func (p *Pool) Gateway() netip.Addr

Gateway return gateway ip

func (*Pool) IPNet

func (p *Pool) IPNet() netip.Prefix

IPNet return raw ipnet

func (*Pool) LookBack

func (p *Pool) LookBack(ip netip.Addr) (string, bool)

LookBack return host with the fake ip

func (*Pool) Lookup

func (p *Pool) Lookup(host string) netip.Addr

Lookup return a fake ip with host

func (*Pool) ShouldSkipped

func (p *Pool) ShouldSkipped(domain string) bool

ShouldSkipped return if domain should be skipped

func (*Pool) StoreState

func (p *Pool) StoreState()

Jump to

Keyboard shortcuts

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