glisten/socket/options

Types

Mapping to the {active, _} option

pub type ActiveState {
  Once
  Passive
  Count(Int)
  Active
}

Constructors

  • Once

    The server acknowledges every package.

  • Passive

    Not used by server - for use with low level tcp.receive.

  • Count(Int)

    The server will receive n packages before activating again.

  • Active

    Connection is always active, no flow control.

pub type ErlangTcpOption
pub type Interface {
  Address(IpAddress)
  Any
  Loopback
}

Constructors

pub type IpAddress {
  IpV4(Int, Int, Int, Int)
  IpV6(Int, Int, Int, Int, Int, Int, Int, Int)
}

Constructors

  • IpV4(Int, Int, Int, Int)
  • IpV6(Int, Int, Int, Int, Int, Int, Int, Int)

Mode for the socket. Currently list is not supported

pub type SocketMode {
  Binary
}

Constructors

  • Binary

Options for the TCP socket

pub type TcpOption {
  Backlog(Int)
  Nodelay(Bool)
  Linger(#(Bool, Int))
  SendTimeout(Int)
  SendTimeoutClose(Bool)
  Reuseaddr(Bool)
  ActiveMode(ActiveState)
  Mode(SocketMode)
  CertKeyConfig(TlsCerts)
  AlpnPreferredProtocols(List(String))
  Ipv6
  Buffer(Int)
  Ip(Interface)
}

Constructors

  • Backlog(Int)

    Default 1024

  • Nodelay(Bool)

    Default True

  • Linger(#(Bool, Int))
  • SendTimeout(Int)

    Default 30_000

  • SendTimeoutClose(Bool)

    Default True

  • Reuseaddr(Bool)

    Default True

  • ActiveMode(ActiveState)

    Default Passive for low level and Once for server.

  • Mode(SocketMode)

    Default Binary

  • CertKeyConfig(TlsCerts)
  • AlpnPreferredProtocols(List(String))
  • Ipv6
  • Buffer(Int)
  • Ip(Interface)
pub type TlsCerts {
  CertKeyFiles(certfile: String, keyfile: String)
}

Constructors

  • CertKeyFiles(certfile: String, keyfile: String)

Values

pub const default_options: List(TcpOption)
pub fn merge_type_list(
  original: List(a),
  override: List(a),
) -> List(a)
pub fn merge_with_defaults(
  options: List(TcpOption),
) -> List(TcpOption)
pub fn to_erl_options(
  options: List(TcpOption),
) -> List(ErlangTcpOption)
Search Document