I am attempting to create an SMTP server using the SOCKS5 proxy using the net library in golang
- Trying to establish a connection to the address via proxy protocol
//addr : mx2.privateemail.com.:25
//proxyURI = "socks5://username:password@xx.yyy.zzz.aaa:port?timeout=10s"
func establishProxyConnection(addr, proxyURI string) (net.Conn, error) {
return socks.Dial(proxyURI)("tcp", addr)
}
- Using the returned connection from step 1, trying to create SMTP connection.
//host: mx1.privateemail.com.
client, err := smtp.NewClient(conn, host)
Further debugging the NewClient method I am getting error EOF at text.ReadResponse(220)
// NewClient returns a new Client using an existing connection and host as a
// server name to be used when authenticating.
func NewClient(conn net.Conn, host string) (*Client, error) {
text := textproto.NewConn(conn)
_, _, err := text.ReadResponse(220)
if err != nil {
text.Close()
return nil, err
}
c := &Client{Text: text, conn: conn, serverName: host, localName: "localhost"}
_, c.tls = conn.(*tls.Conn)
return c, nil
}
I am a novice to all networking concepts, please let me know if any more information needs to be added.
Thanks in advance!