chore(natpmp): initialRetry -> initialConnectionDuration
This commit is contained in:
@@ -19,7 +19,7 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
||||
internalPort uint16
|
||||
requestedExternalPort uint16
|
||||
lifetime time.Duration
|
||||
initialRetry time.Duration
|
||||
initialConnDuration time.Duration
|
||||
exchanges []udpExchange
|
||||
durationSinceStartOfEpoch time.Duration
|
||||
assignedInternalPort uint16
|
||||
@@ -46,7 +46,7 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
||||
internalPort: 123,
|
||||
requestedExternalPort: 456,
|
||||
lifetime: 1200 * time.Second,
|
||||
initialRetry: time.Millisecond,
|
||||
initialConnDuration: time.Millisecond,
|
||||
exchanges: []udpExchange{{close: true}},
|
||||
err: ErrConnectionTimeout,
|
||||
errMessage: "executing remote procedure call: connection timeout: after 1ms",
|
||||
@@ -58,7 +58,7 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
||||
internalPort: 123,
|
||||
requestedExternalPort: 456,
|
||||
lifetime: 1200 * time.Second,
|
||||
initialRetry: time.Second,
|
||||
initialConnDuration: time.Second,
|
||||
exchanges: []udpExchange{{
|
||||
request: []byte{0x0, 0x1, 0x0, 0x0, 0x0, 0x7b, 0x1, 0xc8, 0x0, 0x0, 0x4, 0xb0},
|
||||
response: []byte{0x0, 0x81, 0x0, 0x0, 0x0, 0x13, 0xfe, 0xff, 0x0, 0x7b, 0x1, 0xc8, 0x0, 0x0, 0x4, 0xb0},
|
||||
@@ -75,7 +75,7 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
||||
internalPort: 123,
|
||||
requestedExternalPort: 456,
|
||||
lifetime: 1200 * time.Second,
|
||||
initialRetry: time.Second,
|
||||
initialConnDuration: time.Second,
|
||||
exchanges: []udpExchange{{
|
||||
request: []byte{0x0, 0x2, 0x0, 0x0, 0x0, 0x7b, 0x1, 0xc8, 0x0, 0x0, 0x4, 0xb0},
|
||||
response: []byte{0x0, 0x82, 0x0, 0x0, 0x0, 0x14, 0x3, 0x21, 0x0, 0x7b, 0x1, 0xc8, 0x0, 0x0, 0x4, 0xb0},
|
||||
@@ -86,11 +86,11 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
||||
assignedLifetime: 0x4b0 * time.Second,
|
||||
},
|
||||
"remove_udp": {
|
||||
ctx: context.Background(),
|
||||
gateway: netip.AddrFrom4([4]byte{127, 0, 0, 1}),
|
||||
protocol: "udp",
|
||||
internalPort: 123,
|
||||
initialRetry: time.Second,
|
||||
ctx: context.Background(),
|
||||
gateway: netip.AddrFrom4([4]byte{127, 0, 0, 1}),
|
||||
protocol: "udp",
|
||||
internalPort: 123,
|
||||
initialConnDuration: time.Second,
|
||||
exchanges: []udpExchange{{
|
||||
request: []byte{0x0, 0x1, 0x0, 0x0, 0x0, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
response: []byte{0x0, 0x81, 0x0, 0x0, 0x0, 0x14, 0x3, 0xd5, 0x0, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
@@ -99,11 +99,11 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
||||
assignedInternalPort: 0x7b,
|
||||
},
|
||||
"remove_tcp": {
|
||||
ctx: context.Background(),
|
||||
gateway: netip.AddrFrom4([4]byte{127, 0, 0, 1}),
|
||||
protocol: "tcp",
|
||||
internalPort: 123,
|
||||
initialRetry: time.Second,
|
||||
ctx: context.Background(),
|
||||
gateway: netip.AddrFrom4([4]byte{127, 0, 0, 1}),
|
||||
protocol: "tcp",
|
||||
internalPort: 123,
|
||||
initialConnDuration: time.Second,
|
||||
exchanges: []udpExchange{{
|
||||
request: []byte{0x0, 0x2, 0x0, 0x0, 0x0, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
response: []byte{0x0, 0x82, 0x0, 0x0, 0x0, 0x14, 0x4, 0x96, 0x0, 0x7b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
@@ -121,9 +121,9 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
||||
remoteAddress := launchUDPServer(t, testCase.exchanges)
|
||||
|
||||
client := Client{
|
||||
serverPort: uint16(remoteAddress.Port),
|
||||
initialRetry: testCase.initialRetry,
|
||||
maxRetries: 1,
|
||||
serverPort: uint16(remoteAddress.Port),
|
||||
initialConnectionDuration: testCase.initialConnDuration,
|
||||
maxRetries: 1,
|
||||
}
|
||||
|
||||
durationSinceStartOfEpoch, assignedInternalPort,
|
||||
|
||||
Reference in New Issue
Block a user