mirror of
https://github.com/fatedier/frp.git
synced 2025-07-26 23:29:58 +00:00
frpc: support nathole discover (#3381)
This commit is contained in:
@@ -42,3 +42,7 @@ func ReadMsgInto(c io.Reader, msg Message) (err error) {
|
||||
func WriteMsg(c io.Writer, msg interface{}) (err error) {
|
||||
return msgCtl.WriteMsg(c, msg)
|
||||
}
|
||||
|
||||
func Pack(msg interface{}) (data []byte, err error) {
|
||||
return msgCtl.Pack(msg)
|
||||
}
|
||||
|
@@ -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"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user