install mode and improve relay

This commit is contained in:
TenderIronh
2021-12-09 18:54:46 +08:00
parent a2387fed68
commit f12059d889
16 changed files with 309 additions and 89 deletions
+5 -4
View File
@@ -27,6 +27,7 @@ type AppConfig struct {
shareBandwidth int
}
// TODO: add loglevel, maxlogfilesize
type Config struct {
Network NetworkConfig `json:"network"`
Apps []AppConfig `json:"apps"`
@@ -45,10 +46,10 @@ func (c *Config) add(app AppConfig) {
c.Apps = append(c.Apps, app)
}
// func (c *Config) save() {
// data, _ := json.MarshalIndent(c, "", "")
// ioutil.WriteFile("config.json", data, 0644)
// }
func (c *Config) save() {
data, _ := json.MarshalIndent(c, "", "")
ioutil.WriteFile("config.json", data, 0644)
}
func (c *Config) load() error {
data, err := ioutil.ReadFile("config.json")