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"`
|
HomeDir string `json:"homedir,omitempty"`
|
||||||
Env []string `json:"env,omitempty"`
|
Env []string `json:"env,omitempty"`
|
||||||
User string `json:"user,omitempty"`
|
User string `json:"user,omitempty"`
|
||||||
|
HostName string `json:"hostname,omitempty"`
|
||||||
NotFound bool `json:"notfound,omitempty"`
|
NotFound bool `json:"notfound,omitempty"`
|
||||||
UName string `json:"uname,omitempty"`
|
UName string `json:"uname,omitempty"`
|
||||||
RemoteId string `json:"remoteid,omitempty"`
|
RemoteId string `json:"remoteid,omitempty"`
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (m *MServer) ProcessCommandPacket(pk packet.CommandPacketType) {
|
|||||||
cproc := m.ClientMap[ck]
|
cproc := m.ClientMap[ck]
|
||||||
m.Lock.Unlock()
|
m.Lock.Unlock()
|
||||||
if cproc == nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
cproc.Input.SendPacket(pk)
|
cproc.Input.SendPacket(pk)
|
||||||
|
|||||||
@@ -1060,6 +1060,7 @@ func MakeInitPacket() *packet.InitPacketType {
|
|||||||
if user, _ := user.Current(); user != nil {
|
if user, _ := user.Current(); user != nil {
|
||||||
initPacket.User = user.Username
|
initPacket.User = user.Username
|
||||||
}
|
}
|
||||||
|
initPacket.HostName, _ = os.Hostname()
|
||||||
return initPacket
|
return initPacket
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user