-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
discovery+lnwire: add support for DNS host name in NodeAnnouncement msg #9455
Open
mohamedawnallah
wants to merge
2
commits into
lightningnetwork:master
Choose a base branch
from
mohamedawnallah:supportDNSHostnameInNodeAnnouncement
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,26 +325,28 @@ type Config struct { | |
// loadConfig function. We need to expose the 'raw' strings so the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this commit is doing way too much.
each commit should be one unit of change that the reviewer needs to consider. |
||
// command line library can access them. | ||
// Only the parsed net.Addrs should be used! | ||
RawRPCListeners []string `long:"rpclisten" description:"Add an interface/port/socket to listen for RPC connections"` | ||
RawRESTListeners []string `long:"restlisten" description:"Add an interface/port/socket to listen for REST connections"` | ||
RawListeners []string `long:"listen" description:"Add an interface/port to listen for peer connections"` | ||
RawExternalIPs []string `long:"externalip" description:"Add an ip:port to the list of local addresses we claim to listen on to peers. If a port is not specified, the default (9735) will be used regardless of other parameters"` | ||
ExternalHosts []string `long:"externalhosts" description:"Add a hostname:port that should be periodically resolved to announce IPs for. If a port is not specified, the default (9735) will be used."` | ||
RPCListeners []net.Addr | ||
RESTListeners []net.Addr | ||
RestCORS []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."` | ||
Listeners []net.Addr | ||
ExternalIPs []net.Addr | ||
DisableListen bool `long:"nolisten" description:"Disable listening for incoming peer connections"` | ||
DisableRest bool `long:"norest" description:"Disable REST API"` | ||
DisableRestTLS bool `long:"no-rest-tls" description:"Disable TLS for REST connections"` | ||
WSPingInterval time.Duration `long:"ws-ping-interval" description:"The ping interval for REST based WebSocket connections, set to 0 to disable sending ping messages from the server side"` | ||
WSPongWait time.Duration `long:"ws-pong-wait" description:"The time we wait for a pong response message on REST based WebSocket connections before the connection is closed as inactive"` | ||
NAT bool `long:"nat" description:"Toggle NAT traversal support (using either UPnP or NAT-PMP) to automatically advertise your external IP address to the network -- NOTE this does not support devices behind multiple NATs"` | ||
AddPeers []string `long:"addpeer" description:"Specify peers to connect to first"` | ||
MinBackoff time.Duration `long:"minbackoff" description:"Shortest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."` | ||
MaxBackoff time.Duration `long:"maxbackoff" description:"Longest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."` | ||
ConnectionTimeout time.Duration `long:"connectiontimeout" description:"The timeout value for network connections. Valid time units are {ms, s, m, h}."` | ||
RawRPCListeners []string `long:"rpclisten" description:"Add an interface/port/socket to listen for RPC connections"` | ||
RawRESTListeners []string `long:"restlisten" description:"Add an interface/port/socket to listen for REST connections"` | ||
RawListeners []string `long:"listen" description:"Add an interface/port to listen for peer connections"` | ||
RawExternalIPs []string `long:"externalip" description:"Add an ip:port to the list of local addresses we claim to listen on to peers. If a port is not specified, the default (9735) will be used regardless of other parameters"` | ||
RawExternalDNSHostnameAddress string `long:"external-dns-hostname" description:"Specify a DNS hostname for the node's external address. If no port is provided, the default (9735) is used."` | ||
ExternalHosts []string `long:"externalhosts" description:"Add a hostname:port that should be periodically resolved to announce IPs for. If a port is not specified, the default (9735) will be used."` | ||
RPCListeners []net.Addr | ||
RESTListeners []net.Addr | ||
RestCORS []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."` | ||
Listeners []net.Addr | ||
ExternalIPs []net.Addr | ||
ExternalDNSHostnameAddress *lnwire.DNSHostnameAddress | ||
DisableListen bool `long:"nolisten" description:"Disable listening for incoming peer connections"` | ||
DisableRest bool `long:"norest" description:"Disable REST API"` | ||
DisableRestTLS bool `long:"no-rest-tls" description:"Disable TLS for REST connections"` | ||
WSPingInterval time.Duration `long:"ws-ping-interval" description:"The ping interval for REST based WebSocket connections, set to 0 to disable sending ping messages from the server side"` | ||
WSPongWait time.Duration `long:"ws-pong-wait" description:"The time we wait for a pong response message on REST based WebSocket connections before the connection is closed as inactive"` | ||
NAT bool `long:"nat" description:"Toggle NAT traversal support (using either UPnP or NAT-PMP) to automatically advertise your external IP address to the network -- NOTE this does not support devices behind multiple NATs"` | ||
AddPeers []string `long:"addpeer" description:"Specify peers to connect to first"` | ||
MinBackoff time.Duration `long:"minbackoff" description:"Shortest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."` | ||
MaxBackoff time.Duration `long:"maxbackoff" description:"Longest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."` | ||
ConnectionTimeout time.Duration `long:"connectiontimeout" description:"The timeout value for network connections. Valid time units are {ms, s, m, h}."` | ||
|
||
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify <global-level>,<subsystem>=<level>,<subsystem2>=<level>,... to set the log level for individual subsystems -- Use show to list available subsystems"` | ||
|
||
|
@@ -1555,6 +1557,7 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser, | |
ltndLog.Infof("Listening on the p2p interface is disabled!") | ||
cfg.Listeners = nil | ||
cfg.ExternalIPs = nil | ||
cfg.ExternalDNSHostnameAddress = nil | ||
} else { | ||
|
||
// Add default port to all listener addresses if needed and remove | ||
|
@@ -1578,6 +1581,23 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser, | |
return nil, err | ||
} | ||
|
||
// Add default port to external dnsh hostname address if needed. | ||
if cfg.RawExternalDNSHostnameAddress != "" { | ||
addr, err := parseAddr( | ||
cfg.RawExternalDNSHostnameAddress, cfg.net, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
dnsAddr, ok := addr.(*lnwire.DNSHostnameAddress) | ||
if !ok { | ||
return nil, fmt.Errorf("failed to cast "+ | ||
"address to lnwire.DNSHostnameAddr: "+ | ||
"got %T", addr) | ||
} | ||
cfg.ExternalDNSHostnameAddress = dnsAddr | ||
} | ||
|
||
// For the p2p port it makes no sense to listen to an Unix socket. | ||
// Also, we would need to refactor the brontide listener to support | ||
// that. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a suggestion for PR structure: it's a better pattern to do:
a nice way to think about it is: we always want to be able to revert back to any commit and have things make sense. But with this current order, if we reverted to this commit, we would have all these fields that the server is exposing and the client is writing to but it wont actually do anything on the server side which doesnt make sense