"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/config/client.go" between
frp-0.36.1.tar.gz and frp-0.36.2.tar.gz

About: frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the Internet. As of now, it supports TCP and UDP, as well as HTTP and HTTPS protocols, and it also has a P2P connect mode.

client.go  (frp-0.36.1):client.go  (frp-0.36.2)
skipping to change at line 32 skipping to change at line 32
"github.com/fatedier/frp/pkg/auth" "github.com/fatedier/frp/pkg/auth"
"github.com/fatedier/frp/pkg/util/util" "github.com/fatedier/frp/pkg/util/util"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
) )
// ClientCommonConf contains information for a client service. It is // ClientCommonConf contains information for a client service. It is
// recommended to use GetDefaultClientConf instead of creating this object // recommended to use GetDefaultClientConf instead of creating this object
// directly, so that all unspecified fields have reasonable default values. // directly, so that all unspecified fields have reasonable default values.
type ClientCommonConf struct { type ClientCommonConf struct {
auth.ClientConfig `ini:",extends" json:"inline"` auth.ClientConfig `ini:",extends"`
// ServerAddr specifies the address of the server to connect to. By // ServerAddr specifies the address of the server to connect to. By
// default, this value is "0.0.0.0". // default, this value is "0.0.0.0".
ServerAddr string `ini:"server_addr" josn:"server_addr"` ServerAddr string `ini:"server_addr" josn:"server_addr"`
// ServerPort specifies the port to connect to the server on. By default, // ServerPort specifies the port to connect to the server on. By default,
// this value is 7000. // this value is 7000.
ServerPort int `ini:"server_port" json:"server_port"` ServerPort int `ini:"server_port" json:"server_port"`
// HTTPProxy specifies a proxy address to connect to the server through. If // HTTPProxy specifies a proxy address to connect to the server through. If
// this value is "", the server will be connected to directly. By default , // this value is "", the server will be connected to directly. By default ,
// this value is read from the "http_proxy" environment variable. // this value is read from the "http_proxy" environment variable.
skipping to change at line 176 skipping to change at line 176
TLSCertFile: "", TLSCertFile: "",
TLSKeyFile: "", TLSKeyFile: "",
TLSTrustedCaFile: "", TLSTrustedCaFile: "",
HeartbeatInterval: 30, HeartbeatInterval: 30,
HeartbeatTimeout: 90, HeartbeatTimeout: 90,
Metas: make(map[string]string), Metas: make(map[string]string),
UDPPacketSize: 1500, UDPPacketSize: 1500,
} }
} }
func (cfg *ClientCommonConf) Check() error { func (cfg *ClientCommonConf) Complete() {
if cfg.LogFile == "console" {
cfg.LogWay = "console"
} else {
cfg.LogWay = "file"
}
}
func (cfg *ClientCommonConf) Validate() error {
if cfg.HeartbeatInterval <= 0 { if cfg.HeartbeatInterval <= 0 {
return fmt.Errorf("Parse conf error: invalid heartbeat_interval") return fmt.Errorf("invalid heartbeat_interval")
} }
if cfg.HeartbeatTimeout < cfg.HeartbeatInterval { if cfg.HeartbeatTimeout < cfg.HeartbeatInterval {
return fmt.Errorf("Parse conf error: invalid heartbeat_timeout, h eartbeat_timeout is less than heartbeat_interval") return fmt.Errorf("invalid heartbeat_timeout, heartbeat_timeout i s less than heartbeat_interval")
} }
if cfg.TLSEnable == false { if cfg.TLSEnable == false {
if cfg.TLSCertFile != "" { if cfg.TLSCertFile != "" {
fmt.Println("WARNING! tls_cert_file is invalid when tls_e nable is false") fmt.Println("WARNING! tls_cert_file is invalid when tls_e nable is false")
} }
if cfg.TLSKeyFile != "" { if cfg.TLSKeyFile != "" {
fmt.Println("WARNING! tls_key_file is invalid when tls_en able is false") fmt.Println("WARNING! tls_key_file is invalid when tls_en able is false")
} }
if cfg.TLSTrustedCaFile != "" { if cfg.TLSTrustedCaFile != "" {
fmt.Println("WARNING! tls_trusted_ca_file is invalid when tls_enable is false") fmt.Println("WARNING! tls_trusted_ca_file is invalid when tls_enable is false")
} }
} }
if cfg.Protocol != "tcp" && cfg.Protocol != "kcp" && cfg.Protocol != "web
socket" {
return fmt.Errorf("invalid protocol")
}
return nil return nil
} }
// Supported sources including: string(file path), []byte, Reader interface. // Supported sources including: string(file path), []byte, Reader interface.
func UnmarshalClientConfFromIni(source interface{}) (ClientCommonConf, error) { func UnmarshalClientConfFromIni(source interface{}) (ClientCommonConf, error) {
f, err := ini.LoadSources(ini.LoadOptions{ f, err := ini.LoadSources(ini.LoadOptions{
Insensitive: false, Insensitive: false,
InsensitiveSections: false, InsensitiveSections: false,
InsensitiveKeys: false, InsensitiveKeys: false,
IgnoreInlineComment: true, IgnoreInlineComment: true,
 End of changes. 5 change blocks. 
4 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)