phantoms

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 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 SelectAddrFromSubnet

func SelectAddrFromSubnet(seed []byte, net1 *net.IPNet) (net.IP, error)

SelectAddrFromSubnet - given a seed and a CIDR block choose an address.

This is done by generating a seeded random bytes up to teh length of the
full address then using the net mask to zero out any bytes that are
already specified by the CIDR block. Tde masked random value is then
added to the cidr block base giving the final randomly selected address.

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)

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 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