Add server info to the properties dialog

This commit is contained in:
Gerhard Tan
2025-07-19 16:49:20 +08:00
parent 4cdc9165be
commit 472df0cdfa
11 changed files with 30 additions and 87 deletions

View File

@ -312,18 +312,6 @@ func (conf *ClientConfig) AutoStart() bool {
return !conf.ManualStart
}
func (conf *ClientConfig) GetLogFile() string {
return conf.LogFile
}
func (conf *ClientConfig) SetLogFile(logPath string) {
conf.LogFile = logPath
}
func (conf *ClientConfig) GetSTUNServer() string {
return conf.NatHoleSTUNServer
}
func (conf *ClientConfig) Expiry() bool {
switch conf.DeleteMethod {
case consts.DeleteAbsolute:
@ -334,22 +322,12 @@ func (conf *ClientConfig) Expiry() bool {
return false
}
func (conf *ClientConfig) Items() interface{} {
return conf.Proxies
}
func (conf *ClientConfig) ItemAt(index int) interface{} {
return conf.Proxies[index]
}
func (conf *ClientConfig) DeleteItem(index int) {
func (conf *ClientConfig) DeleteProxy(index int) {
conf.Proxies = append(conf.Proxies[:index], conf.Proxies[index+1:]...)
}
func (conf *ClientConfig) AddItem(item interface{}) {
if proxy, ok := item.(*Proxy); ok {
conf.Proxies = append(conf.Proxies, proxy)
}
func (conf *ClientConfig) AddProxy(proxy *Proxy) {
conf.Proxies = append(conf.Proxies, proxy)
}
func (conf *ClientConfig) Save(path string) error {
@ -475,7 +453,7 @@ func (conf *ClientConfig) Complete(read bool) {
}
}
func (conf *ClientConfig) Copy(all bool) Config {
func (conf *ClientConfig) Copy(all bool) *ClientConfig {
newConf := NewDefaultClientConfig()
newConf.ClientCommon = conf.ClientCommon
// We can't share the same log file between different configs

View File

@ -15,40 +15,6 @@ func init() {
ini.PrettyEqual = true
}
// Config is the interface that a config must implement to support management.
type Config interface {
// Name of this config.
Name() string
// Items returns all sections in this config. which must be a slice of pointer to struct.
Items() interface{}
// ItemAt returns the section in this config for the given index.
ItemAt(index int) interface{}
// DeleteItem deletes the section for the given index.
DeleteItem(index int)
// AddItem adds a section to this config.
AddItem(item interface{})
// Save serializes this config and saves to the given path.
Save(path string) error
// Complete prunes and completes this config.
// When "read" is true, the config should be completed for a file loaded from source.
// Otherwise, it should be completed for file written to disk.
Complete(read bool)
// GetLogFile returns the log file path of this config.
GetLogFile() string
// SetLogFile changes the log file path of this config.
SetLogFile(logPath string)
// AutoStart indicates whether this config should be started at boot.
AutoStart() bool
// Expiry indicates whether the config has an expiry date.
Expiry() bool
// GetSTUNServer returns the STUN server to help penetrate NAT hole.
GetSTUNServer() string
// Copy creates a new copy of this config.
Copy(all bool) Config
// Ext is the file extension of this config.
Ext() string
}
type AutoDelete struct {
// DeleteMethod specifies what delete method to use to delete the config.
// If "absolute" is specified, the expiry date is set in config. If "relative" is specified, the expiry date