merge develop into master #21

Merged
JakeHillion merged 149 commits from develop into master 2021-05-12 00:22:59 +01:00
Showing only changes of commit b870e2707d - Show all commits

View File

@ -71,7 +71,7 @@ func (c Configuration) Build() (*proxy.Proxy, error) {
return p, nil return p, nil
} }
func buildTcp(p *proxy.Proxy, peer Peer, v func() proxy.MacGenerator, g func() proxy.MacVerifier) error { func buildTcp(p *proxy.Proxy, peer Peer, g func() proxy.MacGenerator, v func() proxy.MacVerifier) error {
if peer.RemoteHost != "" { if peer.RemoteHost != "" {
f, err := tcp.InitiateFlow( f, err := tcp.InitiateFlow(
fmt.Sprintf("%s:", peer.LocalHost), fmt.Sprintf("%s:", peer.LocalHost),
@ -82,13 +82,13 @@ func buildTcp(p *proxy.Proxy, peer Peer, v func() proxy.MacGenerator, g func() p
return err return err
} }
p.AddConsumer(f, v()) p.AddConsumer(f, g())
p.AddProducer(f, g()) p.AddProducer(f, v())
return nil return nil
} }
err := tcp.NewListener(p, fmt.Sprintf("%s:%d", peer.LocalHost, peer.LocalPort), g, v) err := tcp.NewListener(p, fmt.Sprintf("%s:%d", peer.LocalHost, peer.LocalPort), v, g)
if err != nil { if err != nil {
return err return err
} }
@ -96,7 +96,7 @@ func buildTcp(p *proxy.Proxy, peer Peer, v func() proxy.MacGenerator, g func() p
return nil return nil
} }
func buildUdp(p *proxy.Proxy, peer Peer, v func() proxy.MacGenerator, g func() proxy.MacVerifier) error { func buildUdp(p *proxy.Proxy, peer Peer, g func() proxy.MacGenerator, v func() proxy.MacVerifier) error {
var c func() udp.Congestion var c func() udp.Congestion
switch peer.Congestion { switch peer.Congestion {
case "None": case "None":
@ -111,8 +111,8 @@ func buildUdp(p *proxy.Proxy, peer Peer, v func() proxy.MacGenerator, g func() p
f, err := udp.InitiateFlow( f, err := udp.InitiateFlow(
fmt.Sprintf("%s:", peer.LocalHost), fmt.Sprintf("%s:", peer.LocalHost),
fmt.Sprintf("%s:%d", peer.RemoteHost, peer.RemotePort), fmt.Sprintf("%s:%d", peer.RemoteHost, peer.RemotePort),
crypto.None{}, v(),
crypto.None{}, g(),
c(), c(),
time.Duration(peer.KeepAlive)*time.Second, time.Duration(peer.KeepAlive)*time.Second,
) )
@ -121,13 +121,13 @@ func buildUdp(p *proxy.Proxy, peer Peer, v func() proxy.MacGenerator, g func() p
return err return err
} }
p.AddConsumer(f, v()) p.AddConsumer(f, g())
p.AddProducer(f, g()) p.AddProducer(f, v())
return nil return nil
} }
err := udp.NewListener(p, fmt.Sprintf("%s:%d", peer.LocalHost, peer.LocalPort), g, v, c) err := udp.NewListener(p, fmt.Sprintf("%s:%d", peer.LocalHost, peer.LocalPort), v, g, c)
if err != nil { if err != nil {
return err return err
} }