phantoms

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultPhantomSubnets

func GetDefaultPhantomSubnets() *pb.PhantomSubnetsList

GetDefaultPhantomSubnets implements the

func GetUnweightedSubnetList added in v1.3.4

func GetUnweightedSubnetList(subnetsList *pb.PhantomSubnetsList) ([]*net.IPNet, error)

Just returns the list of subnets provided by the protobuf. Convenience function to not have to export getSubnets() or parseSubnets()

func SelectAddrFromSubnetOffset added in v1.3.3

func SelectAddrFromSubnetOffset(net1 *net.IPNet, offset *big.Int) (net.IP, error)

SelectAddrFromSubnetOffset given a CIDR block and offset, return the net.IP

func SelectPhantom

func SelectPhantom(seed []byte, subnetsList *pb.PhantomSubnetsList, transform SubnetFilter, weighted bool) (*net.IP, error)

SelectPhantom - select one phantom IP address based on shared secret

func SelectPhantomUnweighted

func SelectPhantomUnweighted(seed []byte, subnets *pb.PhantomSubnetsList, transform SubnetFilter) (*net.IP, error)

SelectPhantomUnweighted - select one phantom IP address based on shared secret

func SelectPhantomWeighted

func SelectPhantomWeighted(seed []byte, subnets *pb.PhantomSubnetsList, transform SubnetFilter) (*net.IP, error)

SelectPhantomWeighted - select one phantom IP address based on shared secret

func V4Only

func V4Only(obj []*net.IPNet) ([]*net.IPNet, error)

V4Only - a functor for transforming the subnet list to only include IPv4 subnets

func V6Only

func V6Only(obj []*net.IPNet) ([]*net.IPNet, error)

V6Only - a functor for transforming the subnet list to only include IPv6 subnets

Types

type Choice added in v1.3.3

type Choice struct {
	Subnets []string
	Weight  int64
}

type SubnetFilter

type SubnetFilter func([]*net.IPNet) ([]*net.IPNet, error)

SubnetFilter - Filter IP subnets based on whatever to prevent specific subnets from

inclusion in choice. See v4Only and v6Only for reference.

Jump to

Keyboard shortcuts

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