Merge branch 'develop' into multiarch
This commit is contained in:
commit
be2d37d3d0
14
.drone.yml
14
.drone.yml
@ -1,8 +1,14 @@
|
|||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: format
|
||||||
|
image: golang:1.15
|
||||||
|
commands:
|
||||||
|
- bash -c "gofmt -l . | wc -l | cmp -s <(echo 0) || (gofmt -l . && exit 1)"
|
||||||
|
|
||||||
- name: install
|
- name: install
|
||||||
image: golang:1.15
|
image: golang:1.15
|
||||||
environment:
|
environment:
|
||||||
@ -49,4 +55,10 @@ steps:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: cache
|
- name: cache
|
||||||
temp: {}
|
temp: { }
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: signature
|
||||||
|
hmac: 8c21312bcfbaa9b7d2d3c31b1a5c13b54b4ecd1da853aa66a8ed11d72154fcca
|
||||||
|
|
||||||
|
...
|
||||||
|
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Jake Hillion
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
@ -88,11 +88,11 @@ func buildUdp(p *proxy.Proxy, peer Peer) error {
|
|||||||
var c func() udp.Congestion
|
var c func() udp.Congestion
|
||||||
switch peer.Congestion {
|
switch peer.Congestion {
|
||||||
case "None":
|
case "None":
|
||||||
c = func() udp.Congestion {return congestion.NewNone()}
|
c = func() udp.Congestion { return congestion.NewNone() }
|
||||||
default:
|
default:
|
||||||
fallthrough
|
fallthrough
|
||||||
case "NewReno":
|
case "NewReno":
|
||||||
c = func() udp.Congestion {return congestion.NewNewReno()}
|
c = func() udp.Congestion { return congestion.NewNewReno() }
|
||||||
}
|
}
|
||||||
|
|
||||||
if peer.RemoteHost != "" {
|
if peer.RemoteHost != "" {
|
||||||
|
@ -24,7 +24,7 @@ type Peer struct {
|
|||||||
RemoteHost string `validate:"required_with=RemotePort,omitempty,fqdn|ip"`
|
RemoteHost string `validate:"required_with=RemotePort,omitempty,fqdn|ip"`
|
||||||
RemotePort uint `validate:"required_with=RemoteHost,omitempty,max=65535"`
|
RemotePort uint `validate:"required_with=RemoteHost,omitempty,max=65535"`
|
||||||
|
|
||||||
Congestion string `validate:"oneof=NewReno None"`
|
Congestion string `validate:"required_unless=Method TCP,omitempty,oneof=NewReno None"`
|
||||||
|
|
||||||
KeepAlive uint
|
KeepAlive uint
|
||||||
Timeout uint
|
Timeout uint
|
||||||
|
@ -30,7 +30,7 @@ func TestUnmarshalPacket(t *testing.T) {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
assert.Len(t, p.Contents(), len(testContent))
|
assert.Len(t, p.Contents(), len(testContent))
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Contents", func(t *testing.T) {
|
t.Run("Contents", func(t *testing.T) {
|
||||||
p, err := UnmarshalSimplePacket(testMarshalled)
|
p, err := UnmarshalSimplePacket(testMarshalled)
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ type NewReno struct {
|
|||||||
keepalive chan bool
|
keepalive chan bool
|
||||||
|
|
||||||
outboundTimes, inboundTimes map[uint32]time.Time
|
outboundTimes, inboundTimes map[uint32]time.Time
|
||||||
outboundTimesLock sync.Mutex
|
outboundTimesLock sync.Mutex
|
||||||
inboundTimesLock sync.RWMutex
|
inboundTimesLock sync.RWMutex
|
||||||
|
|
||||||
ack, lastAck uint32
|
ack, lastAck uint32
|
||||||
nack, lastNack uint32
|
nack, lastNack uint32
|
||||||
@ -34,7 +34,7 @@ type NewReno struct {
|
|||||||
lastSent time.Time
|
lastSent time.Time
|
||||||
hasAcked bool
|
hasAcked bool
|
||||||
|
|
||||||
acksToSend utils.Uint32Heap
|
acksToSend utils.Uint32Heap
|
||||||
acksToSendLock sync.Mutex
|
acksToSendLock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ func TestUnmarshalPacket(t *testing.T) {
|
|||||||
data: proxy.NewSimplePacket(testContent),
|
data: proxy.NewSimplePacket(testContent),
|
||||||
}
|
}
|
||||||
testMarshalled := testPacket.Marshal()
|
testMarshalled := testPacket.Marshal()
|
||||||
|
|
||||||
t.Run("Length", func(t *testing.T) {
|
t.Run("Length", func(t *testing.T) {
|
||||||
p, err := UnmarshalPacket(testMarshalled)
|
p, err := UnmarshalPacket(testMarshalled)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ func TestUnmarshalPacket(t *testing.T) {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
assert.Equal(t, p.Contents(), testContent)
|
assert.Equal(t, p.Contents(), testContent)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Header", func(t *testing.T) {
|
t.Run("Header", func(t *testing.T) {
|
||||||
p, err := UnmarshalPacket(testMarshalled)
|
p, err := UnmarshalPacket(testMarshalled)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user