aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/atlas/config.go4
-rw-r--r--pkg/atlas/server.go4
2 files changed, 7 insertions, 1 deletions
diff --git a/pkg/atlas/config.go b/pkg/atlas/config.go
index 4dea103..ed108c1 100644
--- a/pkg/atlas/config.go
+++ b/pkg/atlas/config.go
@@ -31,6 +31,10 @@ type Config struct {
// The addresses to listen on with TLS (comma-separated).
AddrTLS []string `env:"ATLAS_ADDR_HTTPS"`
+ // The address to listen on and use to send connectionless packets. If the
+ // port is 0, a random one is chosen.
+ AddrUDP netip.AddrPort `env:"ATLAS_ADDR_UDP=:0"`
+
// Whether to trust Cloudflare headers like CF-Connecting-IP.
//
// This is not safe to use unless you:
diff --git a/pkg/atlas/server.go b/pkg/atlas/server.go
index 2956401..a713af8 100644
--- a/pkg/atlas/server.go
+++ b/pkg/atlas/server.go
@@ -41,6 +41,7 @@ type Server struct {
Addr []string
AddrTLS []string
+ AddrUDP netip.AddrPort
Handler http.Handler
Web http.Handler
Redirects map[string]string
@@ -73,6 +74,7 @@ func NewServer(c *Config) (*Server, error) {
s.Addr = c.Addr
s.AddrTLS = c.AddrTLS
+ s.AddrUDP = c.AddrUDP
s.NotifySocket = c.NotifySocket
@@ -916,7 +918,7 @@ func (s *Server) Run(ctx context.Context) error {
}()
}
go func() {
- errch <- s.API0.NSPkt.ListenAndServe(netip.AddrPort{})
+ errch <- s.API0.NSPkt.ListenAndServe(s.AddrUDP)
}()
select {