frpc: support nathole discover (#3381)

This commit is contained in:
fatedier
2023-03-30 20:28:15 +08:00
committed by GitHub
parent 9800b4cfcf
commit a22d6c9504
13 changed files with 521 additions and 17 deletions

View File

@ -37,6 +37,8 @@ const (
TypeNatHoleResp = 'm'
TypeNatHoleClientDetectOK = 'd'
TypeNatHoleSid = '5'
TypeNatHoleBinding = 'b'
TypeNatHoleBindingResp = '6'
)
var msgTypeMap = map[byte]interface{}{
@ -58,6 +60,8 @@ var msgTypeMap = map[byte]interface{}{
TypeNatHoleResp: NatHoleResp{},
TypeNatHoleClientDetectOK: NatHoleClientDetectOK{},
TypeNatHoleSid: NatHoleSid{},
TypeNatHoleBinding: NatHoleBinding{},
TypeNatHoleBindingResp: NatHoleBindingResp{},
}
// When frpc start, client send this message to login to server.
@ -193,3 +197,13 @@ type NatHoleClientDetectOK struct{}
type NatHoleSid struct {
Sid string `json:"sid,omitempty"`
}
type NatHoleBinding struct {
TransactionID string `json:"transaction_id,omitempty"`
}
type NatHoleBindingResp struct {
TransactionID string `json:"transaction_id,omitempty"`
Address string `json:"address,omitempty"`
Error string `json:"error,omitempty"`
}