-
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
Ability to configure neutrino useragent #4353
Ability to configure neutrino useragent #4353
Conversation
Expose the neutrino `UserAgentName` config option. This can be set by starting lnd with the `--neutrino.useragentname=` flag.
Expose the neutrino `UserAgentVersion` config option. This can be set by starting lnd with the `--neutrino.useragentversion=` flag.
@@ -785,6 +785,7 @@ func initNeutrinoBackend(cfg *Config, chainDir string) (*neutrino.ChainService, | |||
|
|||
neutrino.MaxPeers = 8 | |||
neutrino.BanDuration = time.Hour * 48 | |||
neutrino.UserAgentName = cfg.NeutrinoMode.UserAgentName |
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.
just noting: it would be best to avoid overwriting global variables in the package, but given we already do that above that is out of scope for this PR :)
however, currently neutrino.UserAgentName
defaults to "neutrino"
. if the user doesn't set --neutrino.useragentname
then this will be set to an empty string. we can fix this by setting a default value on lncfg.Neutrino
, similar to what is done for bitcoind and btcd subconfigs. this default can simply be neutrino.UserAgentName
since it'll be read before being overwritten here. the same comment applies to the next commit
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.
I've added a new commit that sets these default values.
So do we want to block on fixing that issue, or is this g2g? |
It should be a simple fix. I can pick it up if @mrfelton is unable to continue. |
b6f630a
to
51a5137
Compare
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.
LGTM 🏅 thanks @mrfelton!
@Roasbeef the primary comment has been addressed. longer term we should figure out a solution in the neutrino repo for modifying these values without overwriting globals |
This PR adds the ability to alter the neutrino useragent string so that neutrino clients can identify themselves as they please.
It exposes the neutrino
UserAgentVersion
andUserAgentName
config options which can be set by starting lnd with the--neutrino.useragentversion=
and--neutrino.useragentname=
flags.This enables btcd nodes to better identify connecting clients. For example, it could be used in conjunction with btcd's
agentblacklist
andagentwhitelist
settings to ensure that only clients that identify themselves in a specific way are allowed to connect.