gip

Types

pub type IP {
  V4(#(Int, Int, Int, Int))
  V6(
    #(
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
      Int,
    ),
  )
}

Constructors

  • V4(#(Int, Int, Int, Int))

    An IPV4 respresented as a tuple of 4xInt(Int.Int.Int.Int) All Int’s will fall in the bounds 0 <= Int < 255

  • V6(
      #(
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
        Int,
      ),
    )

    An IPV4 respresented as a tuple of 16xInt(Int.Int.Int.Int.Int.Int.Int.Int.Int.Int.Int.Int.Int.Int.Int.Int) All Int’s will fall in the bounds 0 <= Int < 255

Functions

pub fn is_ip(ip: String) -> Bool

Checks if the provided Ip is a valid Ip

pub fn is_v4(ip: String) -> Bool

Checks if the provided Ip is a valid Ipv4

pub fn is_v6(ip: String) -> Bool

Checks if the provided Ip is a valid Ipv6

pub fn parse(ip: String) -> Result(IP, String)

Parses the provided String into an Ip Or povides a message detailing what went wrong

pub fn self() -> Result(IP, String)

Returns the Ip of the current machine Or povides a message detailing what went wrong

pub fn stringify(ip: IP) -> Result(String, String)

Converts the provided Ip into a String Or povides a message detailing what went wrong

Search Document