Skip to content

Commit

Permalink
Update infrastructure.go
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmin1 committed May 6, 2024
1 parent 540be84 commit ace9894
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rpcclient/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ace9894

Please sign in to comment.