glomp/network

This module contrains TLS settings as well as network related error definitions. You use these through glomp.tls and the client’s Disconnect events.

Types

An error from the network. You get one when connecting to the broker fails, or when reading from or writing to the connection fails.

pub type NetworkError {
  ConnectionClosed
  ConnectionRefused
  ConnectionReset
  ConnectionAborted
  TimedOut
  ConnectionTimedOut
  SocketNotConnected
  BrokenPipe
  HostNotFound
  HostDown
  HostUnreachable
  NetworkDown
  NetworkUnreachable
  AddressInUse
  AddressNotAvailable
  AddressFamilyNotSupported
  TooManyOpenFiles
  SystemFileTableFull
  NoBufferSpace
  OutOfMemory
  PermissionDenied
  OperationNotPermitted
  InvalidArgument
  TlsAlert(alert: TlsAlert, description: String)
  TlsNotAvailable(reason: dynamic.Dynamic)
  InvalidTlsOptions(details: dynamic.Dynamic)
  CertificateFileUnreadable(
    path: String,
    reason: dynamic.Dynamic,
  )
  NoSystemCertificates(reason: dynamic.Dynamic)
  UnknownNetworkError(reason: dynamic.Dynamic)
}

Constructors

  • ConnectionClosed

    The other side closed the connection.

  • ConnectionRefused

    The host refused the connection.

  • ConnectionReset
  • ConnectionAborted
  • TimedOut

    Glomp’s own time limit ran out, such as the connect timeout.

  • ConnectionTimedOut

    The operating system’s time limit for the connection ran out.

  • SocketNotConnected
  • BrokenPipe
  • HostNotFound

    DNS found no address for the host.

  • HostDown
  • HostUnreachable
  • NetworkDown
  • NetworkUnreachable
  • AddressInUse
  • AddressNotAvailable
  • AddressFamilyNotSupported
  • TooManyOpenFiles

    This process has too many files open.

  • SystemFileTableFull

    The whole system has too many files open.

  • NoBufferSpace
  • OutOfMemory
  • PermissionDenied
  • OperationNotPermitted
  • InvalidArgument
  • TlsAlert(alert: TlsAlert, description: String)

    The TLS handshake failed with this alert. description is Erlang’s text for it.

  • TlsNotAvailable(reason: dynamic.Dynamic)

    Erlang’s ssl application failed to start. reason is its error.

  • InvalidTlsOptions(details: dynamic.Dynamic)

    Erlang’s ssl rejected the options. details is its error.

  • CertificateFileUnreadable(path: String, reason: dynamic.Dynamic)

    Reading the certificate file failed. reason is Erlang’s error.

  • NoSystemCertificates(reason: dynamic.Dynamic)

    Loading the system’s certificate authorities failed. reason is Erlang’s error.

  • UnknownNetworkError(reason: dynamic.Dynamic)

    Any other error. reason is Erlang’s error.

A TLS alert, which is the reason one side gives when it ends a TLS handshake. See RFC 8446 section 6.

pub type TlsAlert {
  CloseNotify
  UnexpectedMessage
  BadRecordMac
  RecordOverflow
  HandshakeFailure
  BadCertificate
  UnsupportedCertificate
  CertificateRevoked
  CertificateExpired
  CertificateUnknown
  IllegalParameter
  UnknownCa
  AccessDenied
  DecodeError
  DecryptError
  ProtocolVersion
  InsufficientSecurity
  InternalError
  InappropriateFallback
  UserCancelled
  NoRenegotiation
  MissingExtension
  UnsupportedExtension
  UnrecognisedName
  BadCertificateStatusResponse
  UnknownPskIdentity
  CertificateRequired
  NoApplicationProtocol
  UnknownAlert(name: String)
}

Constructors

  • CloseNotify
  • UnexpectedMessage
  • BadRecordMac
  • RecordOverflow
  • HandshakeFailure
  • BadCertificate
  • UnsupportedCertificate
  • CertificateRevoked
  • CertificateExpired
  • CertificateUnknown
  • IllegalParameter
  • UnknownCa
  • AccessDenied
  • DecodeError
  • DecryptError
  • ProtocolVersion
  • InsufficientSecurity
  • InternalError
  • InappropriateFallback
  • UserCancelled
  • NoRenegotiation
  • MissingExtension
  • UnsupportedExtension
  • UnrecognisedName
  • BadCertificateStatusResponse
  • UnknownPskIdentity
  • CertificateRequired
  • NoApplicationProtocol
  • UnknownAlert(name: String)

    Any other alert.

Which certificates the client accepts from the broker over TLS. A certificate is how the broker proves it is the server you meant to reach.

pub type Trust {
  SystemCertificates
  CertificateFile(path: String)
  Unverified
}

Constructors

  • SystemCertificates

    Certificates signed by the system’s authorities. The host name is checked.

  • CertificateFile(path: String)

    Certificates signed by the authorities in this PEM file. The host name is checked.

  • Unverified

    Any certificate. Use it for testing only. With this setting anyone on the network can pose as the broker and read the traffic.

✨ Search Document