go2hx

manual

github

Module: stdgo.net.netip

(view library index)

Overview

Index

Classes

import

class Netip

Package netip defines an IP address type that's a small value type.
    Building on that [Addr] type, the package also defines [AddrPort] (an
    IP address and a port) and [Prefix] (an IP address and a bit length
    prefix).

Compared to the [net.IP] type, [Addr] type takes less memory, is immutable, and is comparable (supports == and being a map key).

Netip function addrFrom16

function addrFrom16(_addr:haxe.ds.Vector<UInt>):stdgo.net.netip.Addr
AddrFrom16 returns the IPv6 address given by the bytes in addr.
        An IPv4-mapped IPv6 address is left as an IPv6 address.
        (Use Unmap to convert them if needed.)

(view code)

Netip function addrFrom4

function addrFrom4(_addr:haxe.ds.Vector<UInt>):stdgo.net.netip.Addr

AddrFrom4 returns the address of the IPv4 address given by the bytes in addr.

(view code)

Netip function addrFromSlice

function addrFromSlice(_slice:Array<UInt>):stdgo.Tuple<stdgo.net.netip.Addr, Bool>
AddrFromSlice parses the 4- or 16-byte byte slice as an IPv4 or IPv6 address.
        Note that a net.IP can be passed directly as the []byte argument.
        If slice's length is not 4 or 16, AddrFromSlice returns Addr{}, false.

(view code)

Netip function addrPortFrom

function addrPortFrom(_ip:stdgo.net.netip.Addr, _port:UInt):stdgo.net.netip.AddrPort
AddrPortFrom returns an AddrPort with the provided IP and port.
        It does not allocate.

(view code)

Netip function ipv4Unspecified

function ipv4Unspecified():stdgo.net.netip.Addr

IPv4Unspecified returns the IPv4 unspecified address "0.0.0.0".

(view code)

Netip function ipv6LinkLocalAllNodes

function ipv6LinkLocalAllNodes():stdgo.net.netip.Addr
IPv6LinkLocalAllNodes returns the IPv6 link-local all nodes multicast
        address ff02::1.

(view code)

Netip function ipv6LinkLocalAllRouters

function ipv6LinkLocalAllRouters():stdgo.net.netip.Addr
IPv6LinkLocalAllRouters returns the IPv6 link-local all routers multicast
        address ff02::2.

(view code)

Netip function ipv6Loopback

function ipv6Loopback():stdgo.net.netip.Addr

IPv6Loopback returns the IPv6 loopback address ::1.

(view code)

Netip function ipv6Unspecified

function ipv6Unspecified():stdgo.net.netip.Addr

IPv6Unspecified returns the IPv6 unspecified address "::".

(view code)

Netip function mustParseAddr

function mustParseAddr(_s:String):stdgo.net.netip.Addr
MustParseAddr calls ParseAddr(s) and panics on error.
        It is intended for use in tests with hard-coded strings.

(view code)

Netip function mustParseAddrPort

function mustParseAddrPort(_s:String):stdgo.net.netip.AddrPort
MustParseAddrPort calls ParseAddrPort(s) and panics on error.
        It is intended for use in tests with hard-coded strings.

(view code)

Netip function mustParsePrefix

function mustParsePrefix(_s:String):stdgo.net.netip.Prefix
MustParsePrefix calls ParsePrefix(s) and panics on error.
        It is intended for use in tests with hard-coded strings.

(view code)

Netip function parseAddr

function parseAddr(_s:String):stdgo.Tuple<stdgo.net.netip.Addr, stdgo.Error>
ParseAddr parses s as an IP address, returning the result. The string
        s can be in dotted decimal ("192.0.2.1"), IPv6 ("2001:db8::68"),
        or IPv6 with a scoped addressing zone ("fe80::1cc0:3e8c:119f:c2e1%ens18").

(view code)

Netip function parseAddrPort

function parseAddrPort(_s:String):stdgo.Tuple<stdgo.net.netip.AddrPort, stdgo.Error>

ParseAddrPort parses s as an AddrPort.

It doesn't do any name resolution: both the address and the port must be numeric.

(view code)

Netip function parsePrefix

function parsePrefix(_s:String):stdgo.Tuple<stdgo.net.netip.Prefix, stdgo.Error>
ParsePrefix parses s as an IP address prefix.
        The string can be in the form "192.168.1.0/24" or "2001:db8::/32",
        the CIDR notation defined in RFC 4632 and RFC 4291.
        IPv6 zones are not permitted in prefixes, and an error will be returned if a
        zone is present.

Note that masked address bits are not zeroed. Use Masked for that.

(view code)

Netip function prefixFrom

function prefixFrom(_ip:stdgo.net.netip.Addr, _bits:Int):stdgo.net.netip.Prefix
PrefixFrom returns a Prefix with the provided IP address and bit
        prefix length.

It does not allocate. Unlike Addr.Prefix, PrefixFrom does not mask off the host bits of ip.

If bits is less than zero or greater than ip.BitLen, Prefix.Bits will return an invalid value -1.

(view code)

Abstracts

abstract Addr

(view file containing code)

abstract T_parseAddrError

(view file containing code)

abstract AddrPort

(view file containing code)

abstract Prefix

(view file containing code)

abstract T_uint128

(view file containing code)