mirror of
https://github.com/wyx2685/V2bX.git
synced 2025-02-01 22:38:13 -05:00
feat: ntp service
This commit is contained in:
parent
bb16015dab
commit
1aa0b2a8e1
12
conf/sing.go
12
conf/sing.go
@ -2,6 +2,7 @@ package conf
|
|||||||
|
|
||||||
type SingConfig struct {
|
type SingConfig struct {
|
||||||
LogConfig SingLogConfig `json:"Log"`
|
LogConfig SingLogConfig `json:"Log"`
|
||||||
|
NtpConfig SingNtpConfig `json:"NTP"`
|
||||||
OriginalPath string `json:"OriginalPath"`
|
OriginalPath string `json:"OriginalPath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,6 +19,11 @@ func NewSingConfig() *SingConfig {
|
|||||||
Level: "error",
|
Level: "error",
|
||||||
Timestamp: true,
|
Timestamp: true,
|
||||||
},
|
},
|
||||||
|
NtpConfig: SingNtpConfig{
|
||||||
|
Enable: false,
|
||||||
|
Server: "time.apple.com",
|
||||||
|
ServerPort: 0,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,6 +35,12 @@ type SingOptions struct {
|
|||||||
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
|
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SingNtpConfig struct {
|
||||||
|
Enable bool `json:"Enable"`
|
||||||
|
Server string `json:"Server"`
|
||||||
|
ServerPort uint16 `json:"ServerPort"`
|
||||||
|
}
|
||||||
|
|
||||||
type FallBackConfigForSing struct {
|
type FallBackConfigForSing struct {
|
||||||
// sing-box
|
// sing-box
|
||||||
FallBack FallBack `json:"FallBack"`
|
FallBack FallBack `json:"FallBack"`
|
||||||
|
@ -59,6 +59,14 @@ func New(c *conf.CoreConfig) (vCore.Core, error) {
|
|||||||
Timestamp: c.SingConfig.LogConfig.Timestamp,
|
Timestamp: c.SingConfig.LogConfig.Timestamp,
|
||||||
Output: c.SingConfig.LogConfig.Output,
|
Output: c.SingConfig.LogConfig.Output,
|
||||||
}
|
}
|
||||||
|
options.NTP = &option.NTPOptions{
|
||||||
|
Enabled: c.SingConfig.NtpConfig.Enable,
|
||||||
|
WriteToSystem: true,
|
||||||
|
ServerOptions: option.ServerOptions{
|
||||||
|
Server: c.SingConfig.NtpConfig.Server,
|
||||||
|
ServerPort: c.SingConfig.NtpConfig.ServerPort,
|
||||||
|
},
|
||||||
|
}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ctx = pause.ContextWithDefaultManager(ctx)
|
ctx = pause.ContextWithDefaultManager(ctx)
|
||||||
createdAt := time.Now()
|
createdAt := time.Now()
|
||||||
|
@ -16,6 +16,13 @@
|
|||||||
|
|
||||||
"Level": "error",
|
"Level": "error",
|
||||||
"Timestamp": true
|
"Timestamp": true
|
||||||
|
},
|
||||||
|
"NTP": {
|
||||||
|
// 同 SingBox ntp 部分配置
|
||||||
|
// VMess VLESS 建议开启
|
||||||
|
"Enable": true,
|
||||||
|
"Server": "time.apple.com",
|
||||||
|
"ServerPort": 0
|
||||||
}
|
}
|
||||||
// More
|
// More
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user