return username with init packet

This commit is contained in:
sawka 2022-06-17 18:11:49 -07:00
parent 0a6d8b8e9f
commit 315a048f49
2 changed files with 5 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import (
"fmt"
"os"
"os/signal"
"os/user"
"syscall"
"time"
@ -171,6 +172,9 @@ func doMain() {
initPacket.Env = os.Environ()
initPacket.HomeDir = homeDir
initPacket.ScHomeDir = scHomeDir
if user, _ := user.Current(); user != nil {
initPacket.User = user.Username
}
sender.SendPacket(initPacket)
for pk := range packetCh {
if pk.GetType() == packet.PingPacketStr {

View File

@ -235,6 +235,7 @@ type RunnerInitPacketType struct {
ScHomeDir string `json:"schomedir"`
HomeDir string `json:"homedir"`
Env []string `json:"env"`
User string `json:"user"`
}
func (*RunnerInitPacketType) GetType() string {