@@ -62,9 +62,9 @@ func DiscoverNAT(ctx context.Context) (*NAT, error) {
6262 // Log the device addr.
6363 addr , err := natInstance .GetDeviceAddress ()
6464 if err != nil {
65- log .Debug ("DiscoverGateway address error:" , err )
65+ log .Warn ("DiscoverGateway address error:" , err )
6666 } else {
67- log .Debug ("DiscoverGateway address:" , addr )
67+ log .Info ("DiscoverGateway address:" , addr )
6868 }
6969
7070 ctx , cancel := context .WithCancel (context .Background ())
@@ -169,6 +169,8 @@ func (nat *NAT) AddMapping(ctx context.Context, protocol string, port int) error
169169 return nil
170170 }
171171
172+ log .Infof ("Starting maintenance of port mapping: %s/%d" , protocol , port )
173+
172174 // do it once synchronously, so first mapping is done right away, and before exiting,
173175 // allowing users -- in the optimistic case -- to use results right after.
174176 extPort := nat .establishMapping (ctx , protocol , port )
@@ -191,6 +193,7 @@ func (nat *NAT) RemoveMapping(ctx context.Context, protocol string, port int) er
191193 case "tcp" , "udp" :
192194 e := entry {protocol : protocol , port : port }
193195 if _ , ok := nat .mappings [e ]; ok {
196+ log .Infof ("Stopping maintenance of port mapping: %s/%d" , protocol , port )
194197 delete (nat .mappings , e )
195198 return nat .nat .DeletePortMapping (ctx , protocol , port )
196199 }
@@ -292,7 +295,7 @@ func (nat *NAT) establishMapping(ctx context.Context, protocol string, internalP
292295 // Handle success
293296 if err == nil && externalPort != 0 {
294297 nat .consecutiveFailures = 0
295- log .Infof ("NAT port mapping established: %s %d -> %d" , protocol , internalPort , externalPort )
298+ log .Debugf ("NAT port mapping established: %s %d -> %d" , protocol , internalPort , externalPort )
296299 return externalPort
297300 }
298301
0 commit comments