From fda177d8a8e78550963df16589aff4d9a651f459 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Sun, 1 Nov 2020 20:41:42 +0000 Subject: [PATCH] logging and removing buffers --- config/builder.go | 8 ++------ proxy/proxy.go | 4 ++++ tcp/flow.go | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/config/builder.go b/config/builder.go index 01d0fba..e79379a 100644 --- a/config/builder.go +++ b/config/builder.go @@ -23,7 +23,7 @@ func (u UselessMac) Verify([]byte, []byte) error { } func (c Configuration) Build() (*proxy.Proxy, error) { - p := proxy.NewProxy(16) + p := proxy.NewProxy(0) p.Generator = UselessMac{} ss, err := tun.NewTun("nc%d", 1500) @@ -57,11 +57,7 @@ func buildTcp(p *proxy.Proxy, peer Peer) error { p.AddConsumer(f) p.AddProducer(f, UselessMac{}) - if err != nil { - return err - } - - return nil + return err } err := tcp.NewListener(p, fmt.Sprintf("%s:%d", peer.LocalHost, peer.LocalPort), UselessMac{}) diff --git a/proxy/proxy.go b/proxy/proxy.go index 85c7acc..d427ae6 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -92,6 +92,8 @@ func (p Proxy) AddConsumer(c Consumer) { } } } + + fmt.Printf("closed connection `%v`\n", c) }() } @@ -121,5 +123,7 @@ func (p Proxy) AddProducer(pr Producer, v MacVerifier) { } } } + + fmt.Printf("closed connection `%v`\n", pr) }() } diff --git a/tcp/flow.go b/tcp/flow.go index 85d2ede..5f20dd8 100644 --- a/tcp/flow.go +++ b/tcp/flow.go @@ -35,7 +35,6 @@ func InitiateFlow(local, remote string) (*InitiatedFlow, error) { f := InitiatedFlow{ Local: local, Remote: remote, - Flow: Flow{}, } return &f, nil