client: fixup msg.Login, add missing Hostname field

This commit is contained in:
荒野無燈 2019-01-15 18:15:09 +08:00
parent 649a2f2457
commit e414f059a9

View File

@ -17,6 +17,7 @@ package client
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os"
"runtime" "runtime"
"sync" "sync"
"sync/atomic" "sync/atomic"
@ -172,6 +173,7 @@ func (svr *Service) login() (conn frpNet.Conn, session *fmux.Session, err error)
conn = frpNet.WrapConn(stream) conn = frpNet.WrapConn(stream)
} }
hostname, _ := os.Hostname()
now := time.Now().Unix() now := time.Now().Unix()
loginMsg := &msg.Login{ loginMsg := &msg.Login{
Arch: runtime.GOARCH, Arch: runtime.GOARCH,
@ -182,6 +184,7 @@ func (svr *Service) login() (conn frpNet.Conn, session *fmux.Session, err error)
PrivilegeKey: util.GetAuthKey(g.GlbClientCfg.Token, now), PrivilegeKey: util.GetAuthKey(g.GlbClientCfg.Token, now),
Timestamp: now, Timestamp: now,
RunId: svr.runId, RunId: svr.runId,
Hostname: hostname,
} }
if err = msg.WriteMsg(conn, loginMsg); err != nil { if err = msg.WriteMsg(conn, loginMsg); err != nil {