Error while creating smtp.NewClient using socks5 proxy but getting EOF error

I am attempting to create an SMTP server using the SOCKS5 proxy using the net library in golang

  1. 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)
}
  1. 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!

I don’t see anywhere where you are issuing a request and textproto implements a request/response system. I’ve not used textproto before, but I am assuming the reader never gets a response because it’s not ready for one because a request was never sent.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.