you can dial connection by your self, so you can set timeout now.

This commit is contained in:
Tnze
2019-08-27 01:29:11 +08:00
parent cbf3d50d93
commit e63d68d0d7

View File

@ -51,6 +51,16 @@ func DialMC(addr string) (*Conn, error) {
}, err }, err
} }
// WrapConn warp an net.Conn to MC-Conn
// Helps you modify the connection process (eg. set timeout).
func WrapConn(conn net.Conn) *Conn {
return &Conn{
Socket: conn,
ByteReader: bufio.NewReader(conn),
Writer: conn,
}
}
//Close close the connection //Close close the connection
func (c *Conn) Close() error { return c.Socket.Close() } func (c *Conn) Close() error { return c.Socket.Close() }