diff --git a/Makefile b/Makefile index fd4e5b2..1c2f919 100644 --- a/Makefile +++ b/Makefile @@ -35,3 +35,9 @@ kill: fire: \/usr/bin/curl --socks5-hostname 127.0.0.1:7950 http://i2p-projekt.i2p --output i2p-projekt.html \/usr/bin/curl --socks5-hostname 127.0.0.1:7950 http://inr.i2p --output inr.html + +tb: + go build ./conn + go build ./socks + go build ./rewriter + go build ./resolve diff --git a/i2p-projekt.html b/i2p-projekt.html index b3aefce..aeb9c6e 100644 Binary files a/i2p-projekt.html and b/i2p-projekt.html differ diff --git a/inr.html b/inr.html index 7472f4e..cfa2fc4 100644 Binary files a/inr.html and b/inr.html differ diff --git a/socks/manager.go b/socks/manager.go index d808b3a..eaaf8e9 100644 --- a/socks/manager.go +++ b/socks/manager.go @@ -20,7 +20,8 @@ type Manager struct { socks5.Config *sam3.SAM listen net.Listener - conns []conn.Conn + server *socks5.Server + conns []*conn.Conn datadir string host string port string @@ -30,14 +31,7 @@ type Manager struct { } func (m Manager) Serve() error { - server, err := socks5.New(&m.Config) - if err != nil { - return err - } - if m.listen, err = net.Listen("tcp", m.host+":"+m.port); err != nil { - return err - } - if err := server.Serve(m.listen); err != nil { + if err := m.server.Serve(m.listen); err != nil { return err } return nil @@ -59,7 +53,7 @@ func (m *Manager) DialI2P(ctx context.Context, addr string) (*sam3.SAMConn, erro if err != nil { return nil, err } - m.conns = append(m.conns, newconn) + m.conns = append(m.conns, &newconn) log.Println("Generated destination for address:", i2paddr.Base32(), "at position", len(m.conns)-1) return m.conns[len(m.conns)-1].SAMConn, nil } @@ -118,5 +112,12 @@ func NewManagerFromOptions(opts ...func(*Manager) error) (*Manager, error) { } return &m, nil } + m.server, err = socks5.New(&m.Config) + if err != nil { + return nil, err + } + if m.listen, err = net.Listen("tcp", m.host+":"+m.port); err != nil { + return nil, err + } return nil, fmt.Errorf("Resolver creation error.") }