XU XUv0.16.0

#net/netip

import: #net/netip

counts: 5 functions, 17 methods, 3 types, 0 constants, 0 method sets

Addr / AddrPort / Prefix: owning 4- or 16-byte addresses.

struct Addr

XuAPI
pub struct Addr {
    pub ip string
    pub zone string
}

Purpose

Structure encapsulating ip, zone.

Public fields

ip string
field (string)
zone string
field (string)

struct AddrPort

XuAPI
pub struct AddrPort {
    pub addr Addr
    pub port int
}

Purpose

Structure encapsulating addr, port.

Public fields

addr Addr
address
port int
port

struct Prefix

XuAPI
pub struct Prefix {
    pub addr Addr
    pub bits int
}

Purpose

Structure encapsulating addr, bits.

Public fields

addr Addr
address
bits int
bit count

addr_from4

XuAPI
pub fn addr_from4(a int, b int, c int, d int) Addr

Purpose

Address from4.

Parameters

a int
value (int)
b int
b (int)
c int
byte or character code (int)
d int
d (int)

Returns

Addr — a value of this type

addr_from16

XuAPI
pub fn addr_from16(ip string) Addr

Purpose

Address from16. Throws on failure; handle the error or propagate it to the caller.

Parameters

ip string
ip (string)

Returns

Addr — a value of this type

parse_addr

XuAPI
pub fn parse_addr(s string) Addr

Purpose

Parse as addr. Throws on failure; handle the error or propagate it to the caller.

Parameters

s string
source string (string)

Returns

Addr — a value of this type

(Addr) is_valid

XuAPI
pub fn (a Addr) is_valid() bool

Purpose

Operation on Addr: whether it is valid.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) is4

XuAPI
pub fn (a Addr) is4() bool

Purpose

Execute is4 on Addr.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) is6

XuAPI
pub fn (a Addr) is6() bool

Purpose

Execute is6 on Addr.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) is4_in6

XuAPI
pub fn (a Addr) is4_in6() bool

Purpose

Operation on Addr: is4 in6.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) unmap

XuAPI
pub fn (a Addr) unmap() Addr

Purpose

Execute unmap on Addr.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

Addr — a value of this type

(Addr) with_zone

XuAPI
pub fn (a Addr) with_zone(zone string) Addr

Purpose

Operation on Addr: derive a new value with zone.

Parameters

a Addr
The Addr instance used by this call (value receiver).
zone string
zone (string)

Returns

Addr — a value of this type

(Addr) to_string

XuAPI
pub fn (a Addr) to_string() string

Purpose

Operation on Addr: convert to string.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

string — result string

(Addr) is_unspecified

XuAPI
pub fn (a Addr) is_unspecified() bool

Purpose

Operation on Addr: whether it is unspecified.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) is_loopback

XuAPI
pub fn (a Addr) is_loopback() bool

Purpose

Operation on Addr: whether it is loopback.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) is_private

XuAPI
pub fn (a Addr) is_private() bool

Purpose

Operation on Addr: whether it is private.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) is_multicast

XuAPI
pub fn (a Addr) is_multicast() bool

Purpose

Operation on Addr: whether it is multicast.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

(Addr) is_global_unicast

XuAPI
pub fn (a Addr) is_global_unicast() bool

Purpose

Operation on Addr: whether it is global unicast.

Parameters

a Addr
The Addr instance used by this call (value receiver).

Returns

bool — true or false

parse_addr_port

XuAPI
pub fn parse_addr_port(s string) AddrPort

Purpose

Parse as addr port. Throws on failure; handle the error or propagate it to the caller.

Parameters

s string
source string (string)

Returns

AddrPort — a value of this type

(AddrPort) to_string

XuAPI
pub fn (ap AddrPort) to_string() string

Purpose

Operation on AddrPort: convert to string.

Parameters

ap AddrPort
The AddrPort instance used by this call (value receiver).

Returns

string — result string

(AddrPort) is_valid

XuAPI
pub fn (ap AddrPort) is_valid() bool

Purpose

Operation on AddrPort: whether it is valid.

Parameters

ap AddrPort
The AddrPort instance used by this call (value receiver).

Returns

bool — true or false

parse_prefix

XuAPI
pub fn parse_prefix(s string) Prefix

Purpose

Parse as prefix. Throws on failure; handle the error or propagate it to the caller.

Parameters

s string
source string (string)

Returns

Prefix — a value of this type

(Prefix) to_string

XuAPI
pub fn (p Prefix) to_string() string

Purpose

Operation on Prefix: convert to string.

Parameters

p Prefix
The Prefix instance used by this call (value receiver).

Returns

string — result string

(Prefix) contains

XuAPI
pub fn (p Prefix) contains(a Addr) bool

Purpose

Operation on Prefix: report whether the input contains the given piece.

Parameters

p Prefix
The Prefix instance used by this call (value receiver).
a Addr
value (Addr)

Returns

bool — true or false