Skip to content
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

Allow listen.host to contain names #825

Merged
merged 1 commit into from Apr 5, 2023
Merged

Allow listen.host to contain names #825

merged 1 commit into from Apr 5, 2023

Conversation

nbrownus
Copy link
Collaborator

On some networks (like fly.io, DO) it is desirable to listen on specific address and the easiest way to discover that address is by using a known name.

Closes #817

@nbrownus nbrownus added the needs-slack-review Needs review from a Slack team member label Mar 15, 2023
@nbrownus nbrownus added this to the v1.7.0 milestone Mar 15, 2023
Copy link
Collaborator

@jasikpark jasikpark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@@ -107,7 +107,7 @@ lighthouse:
# Port Nebula will be listening on. The default here is 4242. For a lighthouse node, the port should be defined,
# however using port 0 will dynamically assign a port and is recommended for roaming nodes.
listen:
# To listen on both any ipv4 and ipv6 use "[::]"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh I guess this is the zero syntax w/o a port number, but the [ and ] are optional?

listenHost = &net.IPAddr{IP: net.IPv6zero}

} else {
listenHost, err = net.ResolveIPAddr("ip", rawListenHost)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://pkg.go.dev/net#ResolveIPAddr

The address parameter can use a host name, but this is not recommended, because it will return at most one of the host name's IP addresses.

I guess that doesn't matter?

lc := NewListenConfig(multi)
pc, err := lc.ListenPacket(context.TODO(), "udp", fmt.Sprintf("%s:%d", ip, port))
pc, err := lc.ListenPacket(context.TODO(), "udp", net.JoinHostPort(ip.String(), fmt.Sprintf("%v", port)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commenting these function docs for my own understanding, sorry if this is too much:

https://pkg.go.dev/net#JoinHostPort

@wadey wadey removed the needs-slack-review Needs review from a Slack team member label Apr 5, 2023
@jasikpark
Copy link
Collaborator

any docs on this feature to add to https://nebula.defined.net?

@nbrownus nbrownus merged commit 3cb4e0e into master Apr 5, 2023
5 checks passed
@nbrownus nbrownus deleted the listen-host branch April 5, 2023 16:29
gabos31 pushed a commit to oneclick-ag/nebula that referenced this pull request Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: listen.host works with dns names
3 participants