Documentation ¶
Index ¶
- func AreIPsInSameSubnet(ip1, ip2 net.IP) bool
- func GeneratePool(pool, mask string) ([]net.IP, error)
- func GetARPLayer(packet gopacket.Packet) *layers.ARP
- func GetDefaultGatewayIP() (net.IP, error)
- func GetDefaultGatewayInterface() (*net.Interface, error)
- func GetInterfaceByIP(ip net.IP) (*net.Interface, error)
- func GetRouteInterface(dstIP net.IP) (string, error)
- func GetSTPLayer(packet gopacket.Packet) *layers.STP
- func GetTCPLayer(packet gopacket.Packet) *layers.TCP
- func GetTLSLayer(packet gopacket.Packet) *layers.TLS
- func GetUDPLayer(packet gopacket.Packet) *layers.UDP
- func IPbyInt(interfaceName string) string
- func MacByInt(ifaceName string) string
- func ParseIPGen(cidr ...string) string
- func ParseMACGen(cidr ...string) string
- func RandomPort() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreIPsInSameSubnet ¶
AreIPsInSameSubnet Given two IPs, checks if they belong to the same subnet
func GeneratePool ¶
GeneratePool Given a network pool and a mask it will generate all the IPs in the subnet and return the array of the available IPs.
func GetARPLayer ¶
GetARPLayer retrieves the ARP layer of a packet in format gopacket.Packet
func GetDefaultGatewayIP ¶
GetDefaultGatewayInterface Retrives the IP of the default gateway
func GetDefaultGatewayInterface ¶
GetDefaultGatewayInterface retrieves the interface that has connection to the default gateway.
func GetInterfaceByIP ¶
GetInterfaceByIP Given a certain IP, it retrieves the interface with the given IP assigned.
func GetRouteInterface ¶
GetRouteInterface returns the name of the interface that has a routing to the given IP address.
func GetSTPLayer ¶
GetSTPLayer retrieves the STP layer of a packet in format gopacket.Packet
func GetTCPLayer ¶
GetTCPLayer retrieves the TCP layer of a packet in format gopacket.Packet
func GetUDPLayer ¶
GetUDPLayer retrieves the P lUDayer of a packet in format gopacket.Packet
func IPbyInt ¶
IPbyInt given an interface, it checks the OS information and retrieves the IP address assigned to that interface It only supports Unix OS.
func MacByInt ¶
MacByInt given an interface name, it checks the OS information and retrieves the MAC address of that interface. Not that it only supports Unix OS.
func ParseIPGen ¶
ParseIPGen this function, given an empty argument it generates a random IP. If the argument provided is for e.g. "10.0.0.0" it will generate a random IP in that subnet. Note that the default mask is 255.255.255.0
func ParseMACGen ¶
ParseMACGen Generates a Random Mac address
Types ¶
This section is empty.