Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Structs IpAddress

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module juptune.event.io;

struct IpAddress
{
    /++ FUNCTIONS ++/
    
    /// The raw IPv4 address in network order. 
    uint asIpv4();
    /// The raw IPv6 address in network order. 
    ubyte[16LU] asIpv6();
    ///
    void asSocketAddr(sockaddr* used, ulong usedLength, sockaddr_in ipv4, sockaddr_in6 ipv6);
    ///
    static IpAddress fromSocketAddr(const sockaddr* addr);
    /// Returns: The Kind of IP stored. 
    IpAddress.Kind kind();
    ///
    static IpAddress mustParse(const const char[] address, ushort defaultPort = cast(ushort)0u);
    /// Parses an IPv4 or IPv6 address string into an IpAddress object. 
    static Result parse(IpAddress ip, const const char[] address, ushort defaultPort = cast(ushort)0u);
    /// Converts the current address into an IPv6 address. 
    IpAddress toIpv6();
    ///
    void toString(Sink)(Sink sink, bool withPort = true);
    /// Creates a copy of this IpAddress with the given port. 
    IpAddress withPort(ushort port);
    
    /++ ENUMS ++/
    
    /// Result error enum 
    enum Error : int
    {
        ///
        none = 0, 
        /// The given IP string was in an unsupported format, or maybe it's just completely incorrect. 
        invalidAddress = 1
    }
    /// Which IP version the address is for. 
    enum Kind : int
    {
        ///
        FAILSAFE = 0, 
        ///
        ipv4 = 2, 
        ///
        ipv6 = 10
    }
    
    /++ VARIABLES ++/
    
    /// The port represented by the IP address. A value of 0 can mean either "explicit 0" or "no port was provided". 
    nothrow @nogc ushort port;
}

Documentation

Non-IO helper structs

Describe and IP address. Supports IPv4 and IPv6.

Enums

Name Description
Error

Resulterror enum

Kind

Which IP version the address is for.

Functions

Name Description
asIpv4

The raw IPv4 address in network order.

asIpv6

The raw IPv6 address in network order.

asSocketAddr
fromSocketAddr
kind

Returns: The Kindof IP stored.

mustParse
parse

Parses an IPv4 or IPv6 address string into an IpAddressobject.

toIpv6

Converts the current address into an IPv6 address.

toString
withPort

Creates a copy of this IpAddresswith the given port.

Variables

Name Description
port

The port represented by the IP address. A value of 0 can mean either "explicit 0" or "no port was provided".