Meow
2026-05-07 19:10:48 +08:00
committed by RPRX
parent 906d49a271
commit c42deab55c
14 changed files with 75 additions and 42 deletions
+8 -3
View File
@@ -112,6 +112,7 @@ type TrojanUserConfig struct {
// TrojanServerConfig is Inbound configuration
type TrojanServerConfig struct {
Users []*TrojanUserConfig `json:"users"`
Clients []*TrojanUserConfig `json:"clients"`
Fallbacks []*TrojanInboundFallback `json:"fallbacks"`
}
@@ -120,12 +121,16 @@ type TrojanServerConfig struct {
func (c *TrojanServerConfig) Build() (proto.Message, error) {
errors.PrintNonRemovalDeprecatedFeatureWarning("Trojan (with no Flow, etc.)", "VLESS with Flow & Seed")
if c.Clients != nil {
c.Users = c.Clients
}
config := &trojan.ServerConfig{
Users: make([]*protocol.User, len(c.Clients)),
Users: make([]*protocol.User, len(c.Users)),
}
processClient := func(idx int) error {
rawUser := c.Clients[idx]
rawUser := c.Users[idx]
if rawUser.Flow != "" {
return errors.PrintRemovedFeatureError(`Flow for Trojan`, ``)
}
@@ -139,7 +144,7 @@ func (c *TrojanServerConfig) Build() (proto.Message, error) {
}
return nil
}
if err := task.ParallelForN(len(c.Clients), processClient); err != nil {
if err := task.ParallelForN(len(c.Users), processClient); err != nil {
return nil, err
}