mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
add hostname to init packet
This commit is contained in:
@@ -387,6 +387,7 @@ type InitPacketType struct {
|
||||
HomeDir string `json:"homedir,omitempty"`
|
||||
Env []string `json:"env,omitempty"`
|
||||
User string `json:"user,omitempty"`
|
||||
HostName string `json:"hostname,omitempty"`
|
||||
NotFound bool `json:"notfound,omitempty"`
|
||||
UName string `json:"uname,omitempty"`
|
||||
RemoteId string `json:"remoteid,omitempty"`
|
||||
|
||||
@@ -41,7 +41,7 @@ func (m *MServer) ProcessCommandPacket(pk packet.CommandPacketType) {
|
||||
cproc := m.ClientMap[ck]
|
||||
m.Lock.Unlock()
|
||||
if cproc == nil {
|
||||
m.Sender.SendCmdError(ck, fmt.Errorf("no client proc for ck '%s'", ck))
|
||||
m.Sender.SendCmdError(ck, fmt.Errorf("no client proc for ck '%s', pk=%s", ck, packet.AsString(pk)))
|
||||
return
|
||||
}
|
||||
cproc.Input.SendPacket(pk)
|
||||
|
||||
@@ -1060,6 +1060,7 @@ func MakeInitPacket() *packet.InitPacketType {
|
||||
if user, _ := user.Current(); user != nil {
|
||||
initPacket.User = user.Username
|
||||
}
|
||||
initPacket.HostName, _ = os.Hostname()
|
||||
return initPacket
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user