Skip to content

data.ipaddress #

fn ipv4_check #

fn ipv4_check(addr_ string) bool

check if ipv4 address is properly formatted as aaa.bbb.ccc.ddd

fn name_check #

fn name_check(addr_ string) bool

fn new #

fn new(addr_string string) !IPAddress

format: localhost:7777 format: localhost:7777/24 format: 192.168.6.6:7777 format: 192.168.6.6 format ipv6: [x:x:x:x:x:x:x:x]:p format ipv6: [x:x:x:x:x:x:x:x]:p/96 format ipv6: x:x:x:x:x:x:x:x format ipv6: x:x:x:x.../96

enum IpAddressType #

enum IpAddressType {
	ipv4
	ipv6
	name
}

struct IPAddress #

struct IPAddress {
pub mut:
	addr        string // e.g. 192.168.6.6 or x:x:x:x:x:x:x:x
	mask        int    // e.g. 24, default not specified
	cat         IpAddressType = .ipv4
	description string
	port        int
}

fn (IPAddress) ping #

fn (mut ipaddr IPAddress) ping(args_ PingArgs) bool

PingArgs: retry & timeout retry default 1 timeout default 1000 (msec)

fn (IPAddress) toname #

fn (mut ipaddr IPAddress) toname() !string

fn (IPAddress) address #

fn (mut ipaddr IPAddress) address() !string

struct IPNetwork #

struct IPNetwork {
	IPAddress
}

struct IPNetworkRange #

struct IPNetworkRange {
	IPAddress
pub mut:
	from IPAddress
	to   IPAddress
}

specifies a range out of which e.g. ipaddresses can be chosen . note that checks need to be done to make sure that the IPAddresses are part of subnet as specified by parent object

struct PingArgs #

@[params]
struct PingArgs {
pub mut:
	retry   int
	timeout int
}