mirror of
https://github.com/matrix-construct/construct
synced 2024-11-12 04:51:08 +01:00
ircd::net: Add hostport construction from explicit rfc3986::uri.
This commit is contained in:
parent
f092b4214b
commit
180963ca22
1 changed files with 18 additions and 0 deletions
|
@ -67,6 +67,7 @@ struct ircd::net::hostport
|
|||
hostport(const string_view &host, const uint16_t &port);
|
||||
hostport(const string_view &amalgam);
|
||||
hostport(const string_view &amalgam, verbatim_t);
|
||||
explicit hostport(const rfc3986::uri &);
|
||||
hostport() = default;
|
||||
};
|
||||
|
||||
|
@ -91,6 +92,23 @@ ircd::net::hostport::hostport(const string_view &host,
|
|||
}
|
||||
{}
|
||||
|
||||
/// Constructs from an rfc3986 URI i.e https://foo.com or https://foo.com:8080
|
||||
inline
|
||||
ircd::net::hostport::hostport(const rfc3986::uri &uri)
|
||||
:host
|
||||
{
|
||||
rfc3986::host(uri.remote)
|
||||
}
|
||||
,service
|
||||
{
|
||||
uri.scheme
|
||||
}
|
||||
,port
|
||||
{
|
||||
rfc3986::port(uri.remote)
|
||||
}
|
||||
{}
|
||||
|
||||
/// Creates a host:port pair from a hostname and a port number. When
|
||||
/// passed to net::dns() no SRV resolution will be done because no
|
||||
/// service name has been given. (unless manually optioned when using
|
||||
|
|
Loading…
Reference in a new issue