|
|
|
@ -7,7 +7,7 @@ import (
|
|
|
|
|
|
|
|
|
|
// Client holds onto an open Conn to a client, along with connection information
|
|
|
|
|
type Client struct {
|
|
|
|
|
cn *conn
|
|
|
|
|
conn *conn
|
|
|
|
|
ip *net.IP
|
|
|
|
|
port string
|
|
|
|
|
}
|
|
|
|
@ -17,7 +17,7 @@ func NewClient(conn *net.TCPConn) *Client {
|
|
|
|
|
addr, _ := conn.RemoteAddr().(*net.TCPAddr)
|
|
|
|
|
ip, port := &addr.IP, strconv.Itoa(addr.Port)
|
|
|
|
|
return &Client{
|
|
|
|
|
cn: wrapConn(conn),
|
|
|
|
|
conn: wrapConn(conn),
|
|
|
|
|
ip: ip,
|
|
|
|
|
port: port,
|
|
|
|
|
}
|
|
|
|
@ -25,7 +25,7 @@ func NewClient(conn *net.TCPConn) *Client {
|
|
|
|
|
|
|
|
|
|
// Conn returns the underlying conn
|
|
|
|
|
func (c *Client) Conn() *conn {
|
|
|
|
|
return c.cn
|
|
|
|
|
return c.conn
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IP returns the client's IP string
|
|
|
|
|