feat(simnet): add SimNet protocol end-to-end support

- model: SimNet protocol fields + NormalizeSimnet; type+port protocol uniqueness
- server config: OmnXT runtime config delivery via compatible() simnet case
- credentials: derive per-user psk/key_id from subscription (pkg/simnet), no new table
- subscription: adapter buildOmnxtSimnetConfigs + base64 buildOmnxtProtocolLinks + OmnXT SimNet application (migration 02161)
- UA gating: hide experimental protocols from non first-party clients (download + JSON node-list)
- admin: normalize simnet on create/update and on GET responses
- tests: 21 simnet unit tests; full suite green
This commit is contained in:
2026-07-27 00:17:02 -07:00
parent 5ef3f2717e
commit 634b5a7bd0
23 changed files with 1728 additions and 107 deletions
+1
View File
@@ -12,6 +12,7 @@ const (
// Deprecated: Hysteria2 is deprecated, use Hysteria instead
// TODO: remove in future versions
Hysteria2 = "hysteria2"
Simnet = "simnet"
)
type SecurityConfig struct {
@@ -234,6 +234,22 @@ func (l *GetServerConfigLogic) compatible(config node.Protocol) map[string]inter
},
}
case Simnet:
// Simnet ships its whole normalized protocol as the node runtime config
// (server PSK key_id=0, path, carrier, TLS, AF, fallback, reverse, resource
// limits), matching the Pro reference (compat_legacy.go simnet case).
config.NormalizeSimnet()
// Config snapshot log — non-sensitive fields only (never log the PSK).
l.Infow("[GetServerConfig] simnet runtime config",
logger.Field("port", config.Port),
logger.Field("path", config.SimnetPath),
logger.Field("carrier", config.SimnetCarrier),
logger.Field("security", config.Security),
logger.Field("af_enabled", config.SimnetAfEnabled),
logger.Field("fallback_enabled", config.SimnetFallbackEnabled),
)
result = config
}
var resp map[string]interface{}
s, _ := json.Marshal(result)
@@ -38,6 +38,7 @@ func TestNormalizeServerUserListProtocol(t *testing.T) {
{"tuic unchanged", "tuic", "tuic"},
{"shadowsocks unchanged", "shadowsocks", "shadowsocks"},
{"anytls unchanged", "anytls", "anytls"},
{"simnet unchanged", "simnet", "simnet"},
{"empty unchanged", "", ""},
}
for _, c := range cases {