glisten/socket/options

Types

Mapping to the {active, _} option

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

Constructors

  • Once
  • Passive
  • Count(Int)
  • Active

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)
  Certfile(String)
  Keyfile(String)
  AlpnPreferredProtocols(List(String))
  Inet6
}

Constructors

  • Backlog(Int)
  • Nodelay(Bool)
  • Linger(#(Bool, Int))
  • SendTimeout(Int)
  • SendTimeoutClose(Bool)
  • Reuseaddr(Bool)
  • ActiveMode(ActiveState)
  • Mode(SocketMode)
  • Certfile(String)
  • Keyfile(String)
  • AlpnPreferredProtocols(List(String))
  • Inet6

Constants

pub const default_options: List(TcpOption) = [
  Backlog(1024),
  Nodelay(True),
  SendTimeout(30_000),
  SendTimeoutClose(True),
  Reuseaddr(True),
  Mode(Binary),
  ActiveMode(Passive),
]

Functions

pub fn merge_with_defaults(
  options: List(TcpOption),
) -> List(TcpOption)
pub fn to_dict(options: List(TcpOption)) -> Dict(Atom, Dynamic)
Search Document