Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToUint32(in []uint8) (uint32, error)
- func ConnHttpReadRespCodes(conn net.Conn) (codes []int, err error)
- func GetLanIP(interfaceNames NetInterfaceNamesT) (net.IP, error)
- func GetWanIP(ipv4 bool) (net.IP, error)
- func IpToInt(ip net.IP) uint32
- func MaskToBytes[T common.Int](mask T) [4]uint8
- type IPortRange
- type NetInterfaceNamesT
- type WSMsg
Constants ¶
View Source
const ( DEFAULT_HTTP_PORT = 80 DEFAULT_WS_PORT = 80 DEFAULT_WSS_PORT = 443 DEFAULT_HTTPS_PORT = 443 DEFAULT_GRPC_PORT = 9090 )
View Source
const ( // network masks MASK8 uint32 = 0b11111111_00000000_00000000_00000000 MASK12 uint32 = 0b11111111_11110000_00000000_00000000 MASK16 uint32 = 0b11111111_11111111_00000000_00000000 MASK24 uint32 = 0b11111111_11111111_11111111_00000000 MASK32 uint32 = 0b11111111_11111111_11111111_11111111 // reserved IP adresses IP_192_168_0_0 uint32 = 0b11000000_10101000_00000000_00000000 IP_172_16_0_0 uint32 = 0b10101100_00010000_00000000_00000000 IP_10_0_0_0 uint32 = 0b00001010_00000000_00000000_00000000 // reserved for Local Network IP addresses PRESERVED_IP_RANGE_192 uint32 = IP_192_168_0_0 & MASK16 PRESERVED_IP_RANGE_172 uint32 = IP_172_16_0_0 & MASK12 PRESERVED_IP_RANGE_10 uint32 = IP_10_0_0_0 & MASK8 )
Variables ¶
View Source
var ( ErrInitializingRequest = errors.New("error while initializing the request") ErrReadingBody = errors.New("err while reading the body") ErrDialingServ = errors.New("err while dealing the server") ErrInterfaceNotFound = errors.New("provided network interface name wasn't found") )
View Source
var DefaultNetInterfaceNames = NetInterfaceNamesT{
"eth0": {},
"wlan0": {},
}
DefaultNetInterfaceNames are interface names that I have on my machine
Functions ¶
func BytesToUint32 ¶
func ConnHttpReadRespCodes ¶
Optimised to read only response codes Reads response codes until getting EOF or error
func IpToInt ¶
IpToInt converts IP which is a byte array to an integer So it can be used with the bitmasks or be compared fast
func MaskToBytes ¶
Types ¶
type IPortRange ¶
type IPortRange common_utils.IRange[int]
type NetInterfaceNamesT ¶
type NetInterfaceNamesT = map[string]struct{}
type WSMsg ¶
type WSMsg struct { Type int Data json.RawMessage }
Click to show internal directories.
Click to hide internal directories.