Documentation Language: Swift

Method

parseDestination(_:defaultUsername:)

Parse a destination string in user@host[:port] form.

static func parseDestination(_ destination: String, defaultUsername: String? = nil) -> (host: String, port: Int, username: String)

Parameters

destination

Destination string to parse.

defaultUsername

Optional fallback user name.

Return Value

Host, port, and user name extracted from the destination.

Discussion

The parser accepts the same condensed destination style commonly used by command-line SSH clients. When the user name is omitted, it falls back to defaultUsername or the current local account name.