extract relay type

This commit is contained in:
charles 2021-12-05 18:55:04 +08:00
parent 367dc3c334
commit af9130480f

View File

@ -3,6 +3,7 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/yosuke-furukawa/json5/encoding/json5" "github.com/yosuke-furukawa/json5/encoding/json5"
) )
@ -70,6 +71,12 @@ func (c *serverConfig) String() string {
return fmt.Sprintf("%+v", *c) return fmt.Sprintf("%+v", *c)
} }
type Relay struct {
Listen string `json:"listen"`
Remote string `json:"remote"`
Timeout int `json:"timeout"`
}
type clientConfig struct { type clientConfig struct {
Server string `json:"server"` Server string `json:"server"`
UpMbps int `json:"up_mbps"` UpMbps int `json:"up_mbps"`
@ -99,16 +106,10 @@ type clientConfig struct {
DNS []string `json:"dns"` DNS []string `json:"dns"`
Persist bool `json:"persist"` Persist bool `json:"persist"`
} `json:"tun"` } `json:"tun"`
TCPRelay struct { TCPRelays []Relay `json:"relay_tcps"`
Listen string `json:"listen"` TCPRelay Relay `json:"relay_tcp"`
Remote string `json:"remote"` UDPRelays []Relay `json:"relay_udps"`
Timeout int `json:"timeout"` UDPRelay Relay `json:"relay_udp"`
} `json:"relay_tcp"`
UDPRelay struct {
Listen string `json:"listen"`
Remote string `json:"remote"`
Timeout int `json:"timeout"`
} `json:"relay_udp"`
TCPTProxy struct { TCPTProxy struct {
Listen string `json:"listen"` Listen string `json:"listen"`
Timeout int `json:"timeout"` Timeout int `json:"timeout"`