docs: 增加注释

This commit is contained in:
Mmx
2021-12-02 13:46:01 +08:00
parent 680130aaef
commit 07d66ced1e
6 changed files with 18 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ type daemon struct {
Path string
}
// Daemon 后台模式控制包
var Daemon = daemon{
Mark: fmt.Sprint(time.Now().UnixNano()),
Path: global.Config.Settings.Daemon.Path,
@@ -25,10 +26,12 @@ func init() {
}
}
// MarkDaemon 写入后台标记文件
func (a *daemon) MarkDaemon() error {
return tool.File.Write(a.Path, []byte(a.Mark))
}
// CheckDaemon 检查后台标记文件
func (a *daemon) CheckDaemon() bool {
if data, err := tool.File.Read(a.Path); err != nil {
return false
@@ -37,6 +40,7 @@ func (a *daemon) CheckDaemon() bool {
}
}
// DaemonChan 后台标记文件监听
func (a *daemon) DaemonChan() bool {
f, err := fsnotify.NewWatcher()
if err != nil {

View File

@@ -8,6 +8,7 @@ import (
"time"
)
// Guardian 守护模式逻辑
func Guardian(output bool) {
util.Log.OutPut = output
@@ -44,6 +45,7 @@ func Guardian(output bool) {
}
}
// EnterGuardian 守护模式入口控制是否进入daemon
func EnterGuardian() {
util.Log.OutPut = true
util.Log.Println("[Guardian mode]")

View File

@@ -6,6 +6,7 @@ import (
"github.com/Mmx233/BitSrunLoginGo/v1/transfer"
)
// Login 登录逻辑
func Login(output bool, skipCheck bool) error {
return BitSrun.Login(&srunTransfer.Login{
Demo: global.Config.Settings.DemoMode,