improve: OS、Name、DoubleStack 字段加入 meta 配置

fixes #27
This commit is contained in:
Mmx233
2023-12-01 00:20:42 +08:00
parent e76d1a20c3
commit 1f535b3feb
3 changed files with 33 additions and 18 deletions

View File

@@ -9,10 +9,13 @@ type LoginForm struct {
}
type LoginMeta struct {
N string `json:"n" yaml:"n"`
Type string `json:"type" yaml:"type"`
Acid string `json:"acid" yaml:"acid"`
Enc string `json:"enc" yaml:"enc"`
N string `json:"n" yaml:"n"`
Type string `json:"type" yaml:"type"`
Acid string `json:"acid" yaml:"acid"`
Enc string `json:"enc" yaml:"enc"`
OS string `json:"os" yaml:"os"`
Name string `json:"name" yaml:"name"`
DoubleStack bool `json:"double_stack" json:"double_stack"`
}
type LoginInfo struct {

View File

@@ -93,16 +93,25 @@ func (c Srun) DoLogin(clientIP string) error {
tokenStr + EncryptedInfo,
)
res, err = c.api.Login(
c.LoginInfo.Form.Username,
EncryptedMd5,
c.LoginInfo.Meta.Acid,
clientIP,
EncryptedInfo,
EncryptedChkstr,
c.LoginInfo.Meta.N,
c.LoginInfo.Meta.Type,
)
var doubleStack string
if c.LoginInfo.Meta.DoubleStack {
doubleStack = "1"
} else {
doubleStack = "0"
}
res, err = c.api.Login(&LoginRequest{
Username: c.LoginInfo.Form.Username,
Password: EncryptedMd5,
AcID: c.LoginInfo.Meta.Acid,
IP: clientIP,
Info: EncryptedInfo,
ChkSum: EncryptedChkstr,
N: c.LoginInfo.Meta.N,
Type: c.LoginInfo.Meta.Type,
OS: c.LoginInfo.Meta.OS,
Name: c.LoginInfo.Meta.Name,
DoubleStack: doubleStack,
})
if err != nil {
return err
}