Files
hmq/broker/client.go
zhouyuyan fe936d0e37 packet
2017-08-22 16:58:50 +08:00

29 lines
457 B
Go

package broker
import (
"fhmq/lib/message"
"net"
"strings"
)
type client struct {
broker Broker
conn net.Conn
info info
localIP string
remoteIP string
}
type info struct {
clientID []byte
username []byte
password []byte
keeplive uint16
willMsg *message.PublishMessage
}
func (c *client) init() {
c.localIP = strings.Split(c.conn.LocalAddr().String(), ":")[0]
c.remoteIP = strings.Split(c.conn.RemoteAddr().String(), ":")[0]
}