@@ -77,6 +77,10 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
7777 return nil , errors .New (`VLESS clients: "encryption" should not be in inbound settings` )
7878 }
7979
80+ if account .Reverse != nil && account .Reverse .Tag == "" {
81+ return nil , errors .New (`VLESS clients: "tag" can't be empty for "reverse"` )
82+ }
83+
8084 user .Account = serial .ToTypedMessage (account )
8185 config .Clients [idx ] = user
8286 }
@@ -199,13 +203,30 @@ type VLessOutboundVnext struct {
199203}
200204
201205type VLessOutboundConfig struct {
202- Vnext []* VLessOutboundVnext `json:"vnext"`
206+ Address * Address `json:"address"`
207+ Port uint16 `json:"port"`
208+ Level uint32 `json:"level"`
209+ Email string `json:"email"`
210+ Id string `json:"id"`
211+ Flow string `json:"flow"`
212+ Seed string `json:"seed"`
213+ Encryption string `json:"encryption"`
214+ Reverse * vless.Reverse `json:"reverse"`
215+ Vnext []* VLessOutboundVnext `json:"vnext"`
203216}
204217
205218// Build implements Buildable
206219func (c * VLessOutboundConfig ) Build () (proto.Message , error ) {
207220 config := new (outbound.Config )
208-
221+ if c .Address != nil {
222+ c .Vnext = []* VLessOutboundVnext {
223+ {
224+ Address : c .Address ,
225+ Port : c .Port ,
226+ Users : []json.RawMessage {{}},
227+ },
228+ }
229+ }
209230 if len (c .Vnext ) != 1 {
210231 return nil , errors .New (`VLESS settings: "vnext" should have one and only one member` )
211232 }
@@ -224,12 +245,25 @@ func (c *VLessOutboundConfig) Build() (proto.Message, error) {
224245 }
225246 for idx , rawUser := range rec .Users {
226247 user := new (protocol.User )
227- if err := json .Unmarshal (rawUser , user ); err != nil {
228- return nil , errors .New (`VLESS users: invalid user` ).Base (err )
248+ if c .Address != nil {
249+ user .Level = c .Level
250+ user .Email = c .Email
251+ } else {
252+ if err := json .Unmarshal (rawUser , user ); err != nil {
253+ return nil , errors .New (`VLESS users: invalid user` ).Base (err )
254+ }
229255 }
230256 account := new (vless.Account )
231- if err := json .Unmarshal (rawUser , account ); err != nil {
232- return nil , errors .New (`VLESS users: invalid user` ).Base (err )
257+ if c .Address != nil {
258+ account .Id = c .Id
259+ account .Flow = c .Flow
260+ //account.Seed = c.Seed
261+ account .Encryption = c .Encryption
262+ account .Reverse = c .Reverse
263+ } else {
264+ if err := json .Unmarshal (rawUser , account ); err != nil {
265+ return nil , errors .New (`VLESS users: invalid user` ).Base (err )
266+ }
233267 }
234268
235269 u , err := uuid .ParseString (account .Id )
@@ -288,6 +322,10 @@ func (c *VLessOutboundConfig) Build() (proto.Message, error) {
288322 return nil , errors .New (`VLESS users: unsupported "encryption": ` + account .Encryption )
289323 }
290324
325+ if account .Reverse != nil && account .Reverse .Tag == "" {
326+ return nil , errors .New (`VLESS clients: "tag" can't be empty for "reverse"` )
327+ }
328+
291329 user .Account = serial .ToTypedMessage (account )
292330 spec .User [idx ] = user
293331 }
0 commit comments