保存本机只读核查入口并开始全量失败修复
本机协议及菜单已实现,Linux专项通过;全量存在环境缺失和SQLite截止时间失败,尚未通过生产验收。
This commit is contained in:
1 parent
c9045a084f
commit
978f023a7f
23 files changed
+1386
-20
No files matched your search
@@ -9,14 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
conn net.Conn
|
||||
reader *bufio.Reader
|
||||
nonce string
|
||||
methods []Method
|
||||
stage int
|
||||
stop func() bool
|
||||
mu sync.Mutex
|
||||
once sync.Once
|
||||
conn net.Conn
|
||||
reader *bufio.Reader
|
||||
nonce string
|
||||
methods []Method
|
||||
recoveryAvailable bool
|
||||
stage int
|
||||
stop func() bool
|
||||
mu sync.Mutex
|
||||
once sync.Once
|
||||
}
|
||||
|
||||
// Begin 只接受已通过 Dial 校验身份的连接;调用过程不会通过参数或文件传递密码。
|
||||
@@ -36,12 +37,13 @@ func Begin(ctx context.Context, conn net.Conn) (*Client, error) {
|
||||
client.stop = context.AfterFunc(ctx, func() { _ = conn.Close() })
|
||||
var response Response
|
||||
if err := readFrame(client.reader, &response); err != nil || !validChallenge(response) ||
|
||||
len(response.Methods) == 0 || len(response.Methods) > 8 {
|
||||
len(response.Methods) == 0 || len(response.Methods) > 8 || response.RecoveryPage != nil || response.Inspection != nil {
|
||||
_ = client.Close()
|
||||
return nil, ErrProtocol
|
||||
}
|
||||
client.nonce = response.Nonce
|
||||
client.methods = response.Methods
|
||||
client.recoveryAvailable = response.RecoveryAvailable
|
||||
return client, nil
|
||||
}
|
||||
|
||||
@@ -75,6 +77,11 @@ func (c *Client) exchange(request Request, stage int) error {
|
||||
_ = c.Close()
|
||||
return ErrProtocol
|
||||
}
|
||||
if response.RecoveryAvailable || response.RecoveryPage != nil || response.Inspection != nil {
|
||||
c.stage = -1
|
||||
_ = c.Close()
|
||||
return ErrProtocol
|
||||
}
|
||||
if stage == 2 {
|
||||
c.stage = -1
|
||||
_ = c.Close()
|
||||
|
||||
Reference in new issue
Block a user