mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
optimize: sync time is only required if the protocol is vmess. #564
This commit is contained in:
1 parent
d78e621d54
commit
b2a5fdee9c
3 files changed
+6
-6
No files matched your search
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
DisplayFormat = "2006/01/02 15:04"
|
||||
DisplayFormat = "2006/01/02 15:04 MST"
|
||||
)
|
||||
|
||||
func IsDatetimeSynced() (bool, time.Time, error) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/v2rayA/v2rayA/common"
|
||||
"github.com/v2rayA/v2rayA/common/ntp"
|
||||
"github.com/v2rayA/v2rayA/core/coreObj"
|
||||
"github.com/v2rayA/v2rayA/pkg/util/log"
|
||||
"net"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -194,6 +196,9 @@ func (v *V2Ray) Configuration(info PriorInfo) (c Configuration, err error) {
|
||||
}
|
||||
switch strings.ToLower(v.Protocol) {
|
||||
case "vmess":
|
||||
if ok, t, err := ntp.IsDatetimeSynced(); err == nil && !ok {
|
||||
return Configuration{}, fmt.Errorf("please sync datetime first. Your datetime is %v, and the correct datetime is %v", time.Now().Local().Format(ntp.DisplayFormat), t.Local().Format(ntp.DisplayFormat))
|
||||
}
|
||||
core.Settings.Vnext = []coreObj.Vnext{
|
||||
{
|
||||
Address: v.Add,
|
||||
|
||||
@@ -2,13 +2,11 @@ package v2ray
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2rayA/v2rayA/common/ntp"
|
||||
"github.com/v2rayA/v2rayA/common/resolv"
|
||||
"github.com/v2rayA/v2rayA/core/specialMode"
|
||||
"github.com/v2rayA/v2rayA/core/v2ray/asset"
|
||||
"github.com/v2rayA/v2rayA/db/configure"
|
||||
"github.com/v2rayA/v2rayA/pkg/util/log"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CoreProcessManager struct {
|
||||
@@ -45,9 +43,6 @@ func (m *CoreProcessManager) Stop(saveRunning bool) {
|
||||
|
||||
func (m *CoreProcessManager) beforeStart(t *Template) (err error) {
|
||||
resolv.CheckResolvConf()
|
||||
if ok, t, err := ntp.IsDatetimeSynced(); err == nil && !ok {
|
||||
return fmt.Errorf("Please sync datetime first. Your datetime is %v, and the correct datetime is %v", time.Now().Local().Format(ntp.DisplayFormat), t.Local().Format(ntp.DisplayFormat))
|
||||
}
|
||||
|
||||
if (t.Setting.Transparent == configure.TransparentGfwlist || t.Setting.RulePortMode == configure.GfwlistMode) && !asset.DoesV2rayAssetExist("LoyalsoldierSite.dat") {
|
||||
return fmt.Errorf("cannot find GFWList files. update GFWList and try again")
|
||||
|
||||
Reference in new issue
Block a user