-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
重构ddns相关代码 ddns前后端细节优化 修复webhook相关bug
- Loading branch information
Showing
33 changed files
with
1,425 additions
and
831 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
//Copyright 2022 gdy, [email protected] | ||
// Copyright 2022 gdy, [email protected] | ||
package config | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"log" | ||
"net" | ||
"runtime" | ||
"strings" | ||
"sync" | ||
|
||
|
@@ -68,7 +69,7 @@ var programConfigureMutex sync.RWMutex | |
var programConfigure *ProgramConfigure | ||
var configurePath string | ||
|
||
//var readConfigureFileOnce sync.Once | ||
// var readConfigureFileOnce sync.Once | ||
var checkConfigureFileOnce sync.Once | ||
var configureFileSign int8 = -1 | ||
|
||
|
@@ -108,8 +109,7 @@ func SetConfig(p *ProgramConfigure) error { | |
func GetConfig() *ProgramConfigure { | ||
programConfigureMutex.RLock() | ||
defer programConfigureMutex.RUnlock() | ||
var conf ProgramConfigure | ||
conf = *programConfigure | ||
conf := *programConfigure | ||
return &conf | ||
} | ||
|
||
|
@@ -141,7 +141,7 @@ func GetDDNSConfigure() DDNSConfigure { | |
return conf | ||
} | ||
|
||
//保存基础配置 | ||
// 保存基础配置 | ||
func SetBaseConfigure(conf *BaseConfigure) error { | ||
programConfigureMutex.Lock() | ||
defer programConfigureMutex.Unlock() | ||
|
@@ -179,6 +179,11 @@ func SetDDNSConfigure(conf *DDNSConfigure) error { | |
|
||
func Read(filePath string) (err error) { | ||
|
||
if runtime.GOOS == "windows" && filePath == "" { | ||
filePath = "lucky.conf" | ||
log.Printf("未指定配置文件路径,使用默认路径lucky所在位置,默认配置文件名lucky.conf") | ||
} | ||
|
||
pc, err := readProgramConfigure(filePath) | ||
if err != nil { | ||
return err | ||
|
Oops, something went wrong.