mirror of
https://github.com/fatedier/frp.git
synced 2025-08-16 15:42:24 +02:00
update doc and fix vistor -> visitor
This commit is contained in:
@ -595,7 +595,7 @@ type StcpProxyConf struct {
|
||||
LocalSvrConf
|
||||
PluginConf
|
||||
|
||||
// used in role vistor
|
||||
// used in role visitor
|
||||
ServerName string `json:"server_name"`
|
||||
BindAddr string `json:"bind_addr"`
|
||||
BindPort int `json:"bind_port"`
|
||||
@ -632,7 +632,7 @@ func (cfg *StcpProxyConf) LoadFromFile(name string, section ini.Section) (err er
|
||||
}
|
||||
|
||||
tmpStr := section["role"]
|
||||
if tmpStr == "server" || tmpStr == "vistor" {
|
||||
if tmpStr == "server" || tmpStr == "visitor" {
|
||||
cfg.Role = tmpStr
|
||||
} else {
|
||||
cfg.Role = "server"
|
||||
@ -640,7 +640,7 @@ func (cfg *StcpProxyConf) LoadFromFile(name string, section ini.Section) (err er
|
||||
|
||||
cfg.Sk = section["sk"]
|
||||
|
||||
if tmpStr == "vistor" {
|
||||
if tmpStr == "visitor" {
|
||||
prefix := section["prefix"]
|
||||
cfg.ServerName = prefix + section["server_name"]
|
||||
if cfg.BindAddr = section["bind_addr"]; cfg.BindAddr == "" {
|
||||
@ -684,7 +684,7 @@ type XtcpProxyConf struct {
|
||||
LocalSvrConf
|
||||
PluginConf
|
||||
|
||||
// used in role vistor
|
||||
// used in role visitor
|
||||
ServerName string `json:"server_name"`
|
||||
BindAddr string `json:"bind_addr"`
|
||||
BindPort int `json:"bind_port"`
|
||||
@ -721,7 +721,7 @@ func (cfg *XtcpProxyConf) LoadFromFile(name string, section ini.Section) (err er
|
||||
}
|
||||
|
||||
tmpStr := section["role"]
|
||||
if tmpStr == "server" || tmpStr == "vistor" {
|
||||
if tmpStr == "server" || tmpStr == "visitor" {
|
||||
cfg.Role = tmpStr
|
||||
} else {
|
||||
cfg.Role = "server"
|
||||
@ -729,7 +729,7 @@ func (cfg *XtcpProxyConf) LoadFromFile(name string, section ini.Section) (err er
|
||||
|
||||
cfg.Sk = section["sk"]
|
||||
|
||||
if tmpStr == "vistor" {
|
||||
if tmpStr == "visitor" {
|
||||
prefix := section["prefix"]
|
||||
cfg.ServerName = prefix + section["server_name"]
|
||||
if cfg.BindAddr = section["bind_addr"]; cfg.BindAddr == "" {
|
||||
@ -765,7 +765,7 @@ func (cfg *XtcpProxyConf) Check() (err error) {
|
||||
// if len(startProxy) is 0, start all
|
||||
// otherwise just start proxies in startProxy map
|
||||
func LoadProxyConfFromFile(prefix string, conf ini.File, startProxy map[string]struct{}) (
|
||||
proxyConfs map[string]ProxyConf, vistorConfs map[string]ProxyConf, err error) {
|
||||
proxyConfs map[string]ProxyConf, visitorConfs map[string]ProxyConf, err error) {
|
||||
|
||||
if prefix != "" {
|
||||
prefix += "."
|
||||
@ -776,7 +776,7 @@ func LoadProxyConfFromFile(prefix string, conf ini.File, startProxy map[string]s
|
||||
startAll = false
|
||||
}
|
||||
proxyConfs = make(map[string]ProxyConf)
|
||||
vistorConfs = make(map[string]ProxyConf)
|
||||
visitorConfs = make(map[string]ProxyConf)
|
||||
for name, section := range conf {
|
||||
_, shouldStart := startProxy[name]
|
||||
if name != "common" && (startAll || shouldStart) {
|
||||
@ -784,12 +784,12 @@ func LoadProxyConfFromFile(prefix string, conf ini.File, startProxy map[string]s
|
||||
section["prefix"] = prefix
|
||||
cfg, err := NewProxyConfFromFile(name, section)
|
||||
if err != nil {
|
||||
return proxyConfs, vistorConfs, err
|
||||
return proxyConfs, visitorConfs, err
|
||||
}
|
||||
|
||||
role := section["role"]
|
||||
if role == "vistor" {
|
||||
vistorConfs[prefix+name] = cfg
|
||||
if role == "visitor" {
|
||||
visitorConfs[prefix+name] = cfg
|
||||
} else {
|
||||
proxyConfs[prefix+name] = cfg
|
||||
}
|
||||
|
@ -20,23 +20,23 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
TypeLogin = 'o'
|
||||
TypeLoginResp = '1'
|
||||
TypeNewProxy = 'p'
|
||||
TypeNewProxyResp = '2'
|
||||
TypeCloseProxy = 'c'
|
||||
TypeNewWorkConn = 'w'
|
||||
TypeReqWorkConn = 'r'
|
||||
TypeStartWorkConn = 's'
|
||||
TypeNewVistorConn = 'v'
|
||||
TypeNewVistorConnResp = '3'
|
||||
TypePing = 'h'
|
||||
TypePong = '4'
|
||||
TypeUdpPacket = 'u'
|
||||
TypeNatHoleVistor = 'i'
|
||||
TypeNatHoleClient = 'n'
|
||||
TypeNatHoleResp = 'm'
|
||||
TypeNatHoleSid = '5'
|
||||
TypeLogin = 'o'
|
||||
TypeLoginResp = '1'
|
||||
TypeNewProxy = 'p'
|
||||
TypeNewProxyResp = '2'
|
||||
TypeCloseProxy = 'c'
|
||||
TypeNewWorkConn = 'w'
|
||||
TypeReqWorkConn = 'r'
|
||||
TypeStartWorkConn = 's'
|
||||
TypeNewVisitorConn = 'v'
|
||||
TypeNewVisitorConnResp = '3'
|
||||
TypePing = 'h'
|
||||
TypePong = '4'
|
||||
TypeUdpPacket = 'u'
|
||||
TypeNatHoleVisitor = 'i'
|
||||
TypeNatHoleClient = 'n'
|
||||
TypeNatHoleResp = 'm'
|
||||
TypeNatHoleSid = '5'
|
||||
)
|
||||
|
||||
var (
|
||||
@ -56,12 +56,12 @@ func init() {
|
||||
TypeMap[TypeNewWorkConn] = reflect.TypeOf(NewWorkConn{})
|
||||
TypeMap[TypeReqWorkConn] = reflect.TypeOf(ReqWorkConn{})
|
||||
TypeMap[TypeStartWorkConn] = reflect.TypeOf(StartWorkConn{})
|
||||
TypeMap[TypeNewVistorConn] = reflect.TypeOf(NewVistorConn{})
|
||||
TypeMap[TypeNewVistorConnResp] = reflect.TypeOf(NewVistorConnResp{})
|
||||
TypeMap[TypeNewVisitorConn] = reflect.TypeOf(NewVisitorConn{})
|
||||
TypeMap[TypeNewVisitorConnResp] = reflect.TypeOf(NewVisitorConnResp{})
|
||||
TypeMap[TypePing] = reflect.TypeOf(Ping{})
|
||||
TypeMap[TypePong] = reflect.TypeOf(Pong{})
|
||||
TypeMap[TypeUdpPacket] = reflect.TypeOf(UdpPacket{})
|
||||
TypeMap[TypeNatHoleVistor] = reflect.TypeOf(NatHoleVistor{})
|
||||
TypeMap[TypeNatHoleVisitor] = reflect.TypeOf(NatHoleVisitor{})
|
||||
TypeMap[TypeNatHoleClient] = reflect.TypeOf(NatHoleClient{})
|
||||
TypeMap[TypeNatHoleResp] = reflect.TypeOf(NatHoleResp{})
|
||||
TypeMap[TypeNatHoleSid] = reflect.TypeOf(NatHoleSid{})
|
||||
@ -138,7 +138,7 @@ type StartWorkConn struct {
|
||||
ProxyName string `json:"proxy_name"`
|
||||
}
|
||||
|
||||
type NewVistorConn struct {
|
||||
type NewVisitorConn struct {
|
||||
ProxyName string `json:"proxy_name"`
|
||||
SignKey string `json:"sign_key"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
@ -146,7 +146,7 @@ type NewVistorConn struct {
|
||||
UseCompression bool `json:"use_compression"`
|
||||
}
|
||||
|
||||
type NewVistorConnResp struct {
|
||||
type NewVisitorConnResp struct {
|
||||
ProxyName string `json:"proxy_name"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
@ -163,7 +163,7 @@ type UdpPacket struct {
|
||||
RemoteAddr *net.UDPAddr `json:"r"`
|
||||
}
|
||||
|
||||
type NatHoleVistor struct {
|
||||
type NatHoleVisitor struct {
|
||||
ProxyName string `json:"proxy_name"`
|
||||
SignKey string `json:"sign_key"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
@ -175,9 +175,9 @@ type NatHoleClient struct {
|
||||
}
|
||||
|
||||
type NatHoleResp struct {
|
||||
Sid string `json:"sid"`
|
||||
VistorAddr string `json:"vistor_addr"`
|
||||
ClientAddr string `json:"client_addr"`
|
||||
Sid string `json:"sid"`
|
||||
VisitorAddr string `json:"visitor_addr"`
|
||||
ClientAddr string `json:"client_addr"`
|
||||
}
|
||||
|
||||
type NatHoleSid struct {
|
||||
|
Reference in New Issue
Block a user