ensoft/entrance/1.0.4

NOTE: the latest version is 1.0.5

EnTrance.Feature.Target.Connection

Connection management.

Connection details

type alias Params =
{ host : String
, username : String
, secret : String
, authType : AuthType
, sshPort : String
, netconfPort : String
}

Everything needed to connect to a protocol peer.

  • host: IP address or hostname of the peer
  • username: username for authentication
  • secret: either a plaintext password, or the pathame of a file on the EnTrance server containing an ssh key
  • authType: which of the password/ssh key options should be used
  • sshPort: which port to connect to on the peer for ssh operations
  • netconfPort: which port to connect to on the peer for Netconf operations

If you aren't going to use eg Netconf, then it doesn't matter what value is provided for netconfPort.

= Password
| SshKey

Whether the secret part of Params should be interpreted as a password, or a pathname for a file on the EnTrance server containing an ssh key.

Connection state

type State
= Disconnected
| Connected
| FailureWhileDisconnecting String
| Finalizing
| Connecting
| Disconnecting
| ReconnectingAfterFailure String
| FailedToConnect String

Abstracted description of the state of protocol connection. Later constructors are considered "worse" than earlier (eg FailedToConnect is worse than Connected) when multiple connection states are aggregated via target groups.

The states involving failure include a String giving more details.

type alias GroupState =
{ groupState : State
, childName : String
, childState : State
, timestamp : String
}

An aggregate state notification received for a target, or target group. You receive one of these when you used SubscribeToConState when starting a target or target group, and one of the underlying connections just changed state.

  • state: the new overall connection state
  • child: the name of the child whose state just changed
  • childState: the new state of the changed child
  • timestamp: a "HH:MM:SS" string giving a timestamp

Encoders and decoders

decodeState : Decoder State

Decoder for connection state.

decodeGroupState : (GroupState -> msg) -> Decoder msg

Decoder for GroupState. Takes a message constructor.

decodeParams : Decoder Params

Decoder for connection params.

encodeParams : Params -> Value

Encoder for Params. This can be handy for, eg, persisting connection settings.