@@ -15,7 +15,7 @@ import (
15
15
16
16
// See: https://tools.ietf.org/html/rfc5766#section-6.2
17
17
func handleAllocateRequest (r Request , m * stun.Message ) error {
18
- r .Log .Debugf ("Received AllocateRequest from %s" , r .SrcAddr . String () )
18
+ r .Log .Debugf ("Received AllocateRequest from %s" , r .SrcAddr )
19
19
20
20
// 1. The server MUST require that the request be authenticated. This
21
21
// authentication MUST be done using the long-term credential
@@ -177,7 +177,7 @@ func handleAllocateRequest(r Request, m *stun.Message) error {
177
177
}
178
178
179
179
func handleRefreshRequest (r Request , m * stun.Message ) error {
180
- r .Log .Debugf ("Received RefreshRequest from %s" , r .SrcAddr . String () )
180
+ r .Log .Debugf ("Received RefreshRequest from %s" , r .SrcAddr )
181
181
182
182
messageIntegrity , hasAuth , err := authenticateRequest (r , m , stun .MethodRefresh )
183
183
if ! hasAuth {
@@ -211,7 +211,7 @@ func handleRefreshRequest(r Request, m *stun.Message) error {
211
211
}
212
212
213
213
func handleCreatePermissionRequest (r Request , m * stun.Message ) error {
214
- r .Log .Debugf ("Received CreatePermission from %s" , r .SrcAddr . String () )
214
+ r .Log .Debugf ("Received CreatePermission from %s" , r .SrcAddr )
215
215
216
216
a := r .AllocationManager .GetAllocation (& allocation.FiveTuple {
217
217
SrcAddr : r .SrcAddr ,
@@ -236,13 +236,12 @@ func handleCreatePermissionRequest(r Request, m *stun.Message) error {
236
236
}
237
237
238
238
if err := r .AllocationManager .GrantPermission (r .SrcAddr , peerAddress .IP ); err != nil {
239
- r .Log .Infof ("permission denied for client %s to peer %s" , r .SrcAddr .String (),
240
- peerAddress .IP .String ())
239
+ r .Log .Infof ("permission denied for client %s to peer %s" , r .SrcAddr , peerAddress .IP )
241
240
return err
242
241
}
243
242
244
243
r .Log .Debugf ("Adding permission for %s" , fmt .Sprintf ("%s:%d" ,
245
- peerAddress .IP . String () , peerAddress .Port ))
244
+ peerAddress .IP , peerAddress .Port ))
246
245
247
246
a .AddPermission (allocation .NewPermission (
248
247
& net.UDPAddr {
@@ -266,7 +265,7 @@ func handleCreatePermissionRequest(r Request, m *stun.Message) error {
266
265
}
267
266
268
267
func handleSendIndication (r Request , m * stun.Message ) error {
269
- r .Log .Debugf ("Received SendIndication from %s" , r .SrcAddr . String () )
268
+ r .Log .Debugf ("Received SendIndication from %s" , r .SrcAddr )
270
269
a := r .AllocationManager .GetAllocation (& allocation.FiveTuple {
271
270
SrcAddr : r .SrcAddr ,
272
271
DstAddr : r .Conn .LocalAddr (),
@@ -299,7 +298,7 @@ func handleSendIndication(r Request, m *stun.Message) error {
299
298
}
300
299
301
300
func handleChannelBindRequest (r Request , m * stun.Message ) error {
302
- r .Log .Debugf ("Received ChannelBindRequest from %s" , r .SrcAddr . String () )
301
+ r .Log .Debugf ("Received ChannelBindRequest from %s" , r .SrcAddr )
303
302
304
303
a := r .AllocationManager .GetAllocation (& allocation.FiveTuple {
305
304
SrcAddr : r .SrcAddr ,
@@ -328,18 +327,15 @@ func handleChannelBindRequest(r Request, m *stun.Message) error {
328
327
}
329
328
330
329
if err = r .AllocationManager .GrantPermission (r .SrcAddr , peerAddr .IP ); err != nil {
331
- r .Log .Infof ("permission denied for client %s to peer %s" , r .SrcAddr .String (),
332
- peerAddr .IP .String ())
330
+ r .Log .Infof ("permission denied for client %s to peer %s" , r .SrcAddr , peerAddr .IP )
333
331
334
332
unauthorizedRequestMsg := buildMsg (m .TransactionID ,
335
333
stun .NewType (stun .MethodChannelBind , stun .ClassErrorResponse ),
336
334
& stun.ErrorCodeAttribute {Code : stun .CodeUnauthorized })
337
335
return buildAndSendErr (r .Conn , r .SrcAddr , err , unauthorizedRequestMsg ... )
338
336
}
339
337
340
- r .Log .Debugf ("Binding channel %d to %s" ,
341
- channel ,
342
- fmt .Sprintf ("%s:%d" , peerAddr .IP .String (), peerAddr .Port ))
338
+ r .Log .Debugf ("Binding channel %d to %s" , channel , peerAddr )
343
339
err = a .AddChannelBind (allocation .NewChannelBind (
344
340
channel ,
345
341
& net.UDPAddr {IP : peerAddr .IP , Port : peerAddr .Port },
@@ -353,7 +349,7 @@ func handleChannelBindRequest(r Request, m *stun.Message) error {
353
349
}
354
350
355
351
func handleChannelData (r Request , c * proto.ChannelData ) error {
356
- r .Log .Debugf ("Received ChannelData from %s" , r .SrcAddr . String () )
352
+ r .Log .Debugf ("Received ChannelData from %s" , r .SrcAddr )
357
353
358
354
a := r .AllocationManager .GetAllocation (& allocation.FiveTuple {
359
355
SrcAddr : r .SrcAddr ,
0 commit comments