File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -365,18 +365,21 @@ func Start(opts ServerOptions) (*Server, error) {
365
365
}
366
366
367
367
func listenAndServe (network Network , opts ServerOptions ) (* dns.Server , error ) {
368
+ var addr string
368
369
// always enable reply truncate for UDP
369
370
if network == UDP {
370
371
opts .TruncateReply = true
372
+ addr = fmt .Sprintf ("%s:%d" , opts .Address , opts .UDPPort )
373
+ } else {
374
+ addr = fmt .Sprintf ("%s:%d" , opts .Address , opts .TCPPort )
371
375
}
372
376
h , err := NewHandler (opts .HandlerOptions )
373
377
if err != nil {
374
378
return nil , err
375
379
}
376
- addr := fmt .Sprintf ("%s:%d" , opts .Address , opts .UDPPort )
377
380
s := & dns.Server {Net : string (network ), Addr : addr , Handler : h }
378
381
go func () {
379
- logrus .Debugf ("Start UDP server listening on: %v" , addr )
382
+ logrus .Debugf ("Start %v server listening on: %v" , network , addr )
380
383
if e := s .ListenAndServe (); e != nil {
381
384
panic (e )
382
385
}
You can’t perform that action at this time.
0 commit comments