mirror of
https://github.com/fhmq/hmq.git
synced 2026-04-30 05:28:34 +00:00
29 lines
457 B
Go
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]
|
|
}
|