测试2
This commit is contained in:
@@ -403,8 +403,11 @@ func (s *Service) setupNode() error {
|
|||||||
Method: method,
|
Method: method,
|
||||||
Password: serverKey,
|
Password: serverKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If no colon is used in client, we might need a fallback.
|
||||||
|
// We'll leave it to be updated dynamically when users sync.
|
||||||
inboundOptions = &ssOptions
|
inboundOptions = &ssOptions
|
||||||
s.logger.Info("Xboard Shadowsocks 2022 setup. Method: ", method, " Password preview: ", serverKey[:8], "...")
|
s.logger.Info("Xboard Shadowsocks 2022 setup. Method: ", method, " PSK preview: ", serverKey[:8], "...")
|
||||||
case "trojan":
|
case "trojan":
|
||||||
trojanOptions := option.TrojanInboundOptions{
|
trojanOptions := option.TrojanInboundOptions{
|
||||||
ListenOptions: option.ListenOptions{
|
ListenOptions: option.ListenOptions{
|
||||||
@@ -475,10 +478,12 @@ func (s *Service) fetchConfig() (*XNodeConfig, error) {
|
|||||||
// Check time drift
|
// Check time drift
|
||||||
if dateStr := resp.Header.Get("Date"); dateStr != "" {
|
if dateStr := resp.Header.Get("Date"); dateStr != "" {
|
||||||
if panelTime, err := http.ParseTime(dateStr); err == nil {
|
if panelTime, err := http.ParseTime(dateStr); err == nil {
|
||||||
drift := time.Since(panelTime)
|
localTime := time.Now()
|
||||||
|
drift := localTime.Sub(panelTime)
|
||||||
if drift < 0 { drift = -drift }
|
if drift < 0 { drift = -drift }
|
||||||
|
s.logger.Info("TIME CHECK: Panel Local [", panelTime.Format(time.RFC3339), "] vs Server Local [", localTime.Format(time.RFC3339), "]. Drift: ", drift)
|
||||||
if drift > 30*time.Second {
|
if drift > 30*time.Second {
|
||||||
s.logger.Error("CRITICAL TIME DRIFT: ", drift, " off from Panel. SS 2022 WILL FAIL. Sync your time!")
|
s.logger.Error("CRITICAL TIME DRIFT: Your server time is OUT OF SYNC. Shadowsocks 2022 WILL FAIL!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -598,6 +603,20 @@ func (s *Service) syncUsers() {
|
|||||||
// Update local ID mapping
|
// Update local ID mapping
|
||||||
s.localUsers = newUsers
|
s.localUsers = newUsers
|
||||||
|
|
||||||
|
// Compatibility Hack: For SS 2022 without colon,
|
||||||
|
// we may need the first user's key as the global PSK
|
||||||
|
if isSS2022 && len(newUsers) > 0 {
|
||||||
|
for _, u := range newUsers {
|
||||||
|
for _, managedServer := range s.servers {
|
||||||
|
if ssInbound, ok := managedServer.(interface{ SetPassword(string) }); ok {
|
||||||
|
ssInbound.SetPassword(u.Key)
|
||||||
|
s.logger.Info("Compatibility Mode: Set global PSK to user key: ", u.Key[:8], "...")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break // Only use the first one as fallback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s.logger.Info("Xboard sync completed, total users: ", len(users))
|
s.logger.Info("Xboard sync completed, total users: ", len(users))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user