Conns aren't being saved

This commit is contained in:
idk 2018-12-26 14:22:16 -05:00
parent 357e48a012
commit 4544aec918
No known key found for this signature in database
GPG key ID: D75C03B39B5E14E1
4 changed files with 17 additions and 10 deletions

View file

@ -35,3 +35,9 @@ kill:
fire: 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://i2p-projekt.i2p --output i2p-projekt.html
\/usr/bin/curl --socks5-hostname 127.0.0.1:7950 http://inr.i2p --output inr.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

Binary file not shown.

BIN
inr.html

Binary file not shown.

View file

@ -20,7 +20,8 @@ type Manager struct {
socks5.Config socks5.Config
*sam3.SAM *sam3.SAM
listen net.Listener listen net.Listener
conns []conn.Conn server *socks5.Server
conns []*conn.Conn
datadir string datadir string
host string host string
port string port string
@ -30,14 +31,7 @@ type Manager struct {
} }
func (m Manager) Serve() error { func (m Manager) Serve() error {
server, err := socks5.New(&m.Config) if err := m.server.Serve(m.listen); err != nil {
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 {
return err return err
} }
return nil return nil
@ -59,7 +53,7 @@ func (m *Manager) DialI2P(ctx context.Context, addr string) (*sam3.SAMConn, erro
if err != nil { if err != nil {
return nil, err 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) log.Println("Generated destination for address:", i2paddr.Base32(), "at position", len(m.conns)-1)
return m.conns[len(m.conns)-1].SAMConn, nil return m.conns[len(m.conns)-1].SAMConn, nil
} }
@ -118,5 +112,12 @@ func NewManagerFromOptions(opts ...func(*Manager) error) (*Manager, error) {
} }
return &m, nil 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.") return nil, fmt.Errorf("Resolver creation error.")
} }