mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dns: support default port 53 in dnsserver config
This commit is contained in:
1 parent
c86cadb4be
commit
6bd77a0b2a
5 files changed
+21
-12
No files matched your search
+10
-1
@@ -1,6 +1,9 @@
|
||||
package dns
|
||||
|
||||
import "sync/atomic"
|
||||
import (
|
||||
"net"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
// UPStream is a dns upstream.
|
||||
type UPStream struct {
|
||||
@@ -10,6 +13,12 @@ type UPStream struct {
|
||||
|
||||
// NewUPStream returns a new UpStream.
|
||||
func NewUPStream(servers []string) *UPStream {
|
||||
// default port for dns upstream servers
|
||||
for i, server := range servers {
|
||||
if _, port, _ := net.SplitHostPort(server); port == "" {
|
||||
servers[i] = net.JoinHostPort(server, "53")
|
||||
}
|
||||
}
|
||||
return &UPStream{servers: servers}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user