Skip to content

Commit

Permalink
v1.2.1
Browse files Browse the repository at this point in the history
重构ddns相关代码
ddns前后端细节优化
修复webhook相关bug
  • Loading branch information
gdy666 committed Aug 8, 2022
1 parent a5b5881 commit 6a1ce52
Show file tree
Hide file tree
Showing 33 changed files with 1,425 additions and 831 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lucky
*.out
*.log
*.upx

lucky.conf

# Dependency directories (remove the comment below to include it)
# vendor/
Expand Down
14 changes: 8 additions & 6 deletions config/info.go → config/appinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
)

type AppInfo struct {
AppName string
Version string
OS string
ARCH string
Date string
RunTime string
AppName string
Version string
OS string
ARCH string
Date string
RunTime string
GoVersion string
}

var appInfo AppInfo
Expand All @@ -27,6 +28,7 @@ func InitAppInfo(version, date string) {
appInfo.OS = runtime.GOOS
appInfo.ARCH = runtime.GOARCH
appInfo.RunTime = time.Now().Format("2006-01-02 15:04:05")
appInfo.GoVersion = runtime.Version()

time.Now().Format("2006-01-02T15:04:05Z")

Expand Down
15 changes: 10 additions & 5 deletions config/config.go
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"

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -141,7 +141,7 @@ func GetDDNSConfigure() DDNSConfigure {
return conf
}

//保存基础配置
// 保存基础配置
func SetBaseConfigure(conf *BaseConfigure) error {
programConfigureMutex.Lock()
defer programConfigureMutex.Unlock()
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 6a1ce52

Please sign in to comment.