From ace9894587d205d29dbd56b55b7d1a26a07cc8c5 Mon Sep 17 00:00:00 2001 From: Robert <104002271+robertmin1@users.noreply.github.com> Date: Mon, 6 May 2024 11:18:57 +0300 Subject: [PATCH] Update infrastructure.go --- rpcclient/infrastructure.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 89e8c4067c6..9ba57aac6f0 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -1726,6 +1726,10 @@ func (c *Client) Send() error { return nil } +// ParseAddressString converts an address in string format to a net.Addr that is +// compatible with lnd. UDP is not supported because lnd needs reliable +// connections. We accept a custom function to resolve any TCP addresses so +// that caller is able control exactly how resolution is performed. func ParseAddressString(strAddress string, defaultPort string) (net.Addr, error) { var parsedNetwork, parsedAddr string @@ -1766,6 +1770,10 @@ func ParseAddressString(strAddress string, defaultPort string) (net.Addr, error) } } +// verifyPort makes sure that an address string has both a host and a port. If +// there is no port found, the default port is appended. If the address is just +// a port, then we'll assume that the user is using the short cut to specify a +// localhost:port address. func verifyPort(address string, defaultPort string) string { host, port, err := net.SplitHostPort(address) if err != nil {