@@ -159,8 +159,8 @@ func (c *APIClient) GetNodeInfo() (nodeInfo *api.NodeInfo, err error) {
159
159
res , err := c .client .R ().
160
160
SetHeader ("If-None-Match" , c .eTags ["config" ]).
161
161
SetQueryParams (map [string ]string {
162
- "act" : "config" ,
163
- "nodetype " : nodeType ,
162
+ "act" : "config" ,
163
+ "node_type " : nodeType ,
164
164
}).
165
165
ForceContentType ("application/json" ).
166
166
Get (c .APIHost )
@@ -213,8 +213,8 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) {
213
213
res , err := c .client .R ().
214
214
SetHeader ("If-None-Match" , c .eTags ["user" ]).
215
215
SetQueryParams (map [string ]string {
216
- "act" : "user" ,
217
- "nodetype " : nodeType ,
216
+ "act" : "user" ,
217
+ "node_type " : nodeType ,
218
218
}).
219
219
ForceContentType ("application/json" ).
220
220
Get (c .APIHost )
@@ -239,22 +239,21 @@ func (c *APIClient) GetUserList() (UserList *[]api.UserInfo, err error) {
239
239
user .UID = response .Get ("data" ).GetIndex (i ).Get ("id" ).MustInt ()
240
240
switch c .NodeType {
241
241
case "Shadowsocks" :
242
- user .Email = response .Get ("data" ).GetIndex (i ).Get ("shadowsocks_user" ). Get ( " secret" ).MustString ()
243
- user .Passwd = response .Get ("data" ).GetIndex (i ).Get ("shadowsocks_user" ). Get ( " secret" ).MustString ()
244
- user .Method = response .Get ("data" ).GetIndex (i ).Get ("shadowsocks_user" ). Get ( " cipher" ).MustString ()
245
- user .SpeedLimit = response .Get ("data" ).GetIndex (i ).Get ("shadowsocks_user" ). Get ( "speed_limit " ).MustUint64 () * 1000000 / 8
246
- user .DeviceLimit = response .Get ("data" ).GetIndex (i ).Get ("shadowsocks_user" ). Get ( "device_limit " ).MustInt ()
242
+ user .Email = response .Get ("data" ).GetIndex (i ).Get ("secret" ).MustString ()
243
+ user .Passwd = response .Get ("data" ).GetIndex (i ).Get ("secret" ).MustString ()
244
+ user .Method = response .Get ("data" ).GetIndex (i ).Get ("cipher" ).MustString ()
245
+ user .SpeedLimit = response .Get ("data" ).GetIndex (i ).Get ("st " ).MustUint64 () * 1000000 / 8
246
+ user .DeviceLimit = response .Get ("data" ).GetIndex (i ).Get ("dt " ).MustInt ()
247
247
case "Trojan" :
248
- user .UUID = response .Get ("data" ).GetIndex (i ).Get ("trojan_user" ). Get ( " password" ).MustString ()
249
- user .Email = response .Get ("data" ).GetIndex (i ).Get ("trojan_user" ). Get ( " password" ).MustString ()
250
- user .SpeedLimit = response .Get ("data" ).GetIndex (i ).Get ("trojan_user" ). Get ( "speed_limit " ).MustUint64 () * 1000000 / 8
251
- user .DeviceLimit = response .Get ("data" ).GetIndex (i ).Get ("trojan_user" ). Get ( "device_limit " ).MustInt ()
248
+ user .UUID = response .Get ("data" ).GetIndex (i ).Get ("password" ).MustString ()
249
+ user .Email = response .Get ("data" ).GetIndex (i ).Get ("password" ).MustString ()
250
+ user .SpeedLimit = response .Get ("data" ).GetIndex (i ).Get ("st " ).MustUint64 () * 1000000 / 8
251
+ user .DeviceLimit = response .Get ("data" ).GetIndex (i ).Get ("dt " ).MustInt ()
252
252
case "V2ray" , "Vmess" , "Vless" :
253
- user .UUID = response .Get ("data" ).GetIndex (i ).Get ("v2ray_user" ).Get ("uuid" ).MustString ()
254
- user .Email = response .Get ("data" ).GetIndex (i ).Get ("v2ray_user" ).Get ("email" ).MustString ()
255
- user .AlterID = uint16 (response .Get ("data" ).GetIndex (i ).Get ("v2ray_user" ).Get ("alter_id" ).MustUint64 ())
256
- user .SpeedLimit = response .Get ("data" ).GetIndex (i ).Get ("v2ray_user" ).Get ("speed_limit" ).MustUint64 () * 1000000 / 8
257
- user .DeviceLimit = response .Get ("data" ).GetIndex (i ).Get ("v2ray_user" ).Get ("device_limit" ).MustInt ()
253
+ user .UUID = response .Get ("data" ).GetIndex (i ).Get ("uuid" ).MustString ()
254
+ user .Email = user .UUID + "@x.com"
255
+ user .SpeedLimit = response .Get ("data" ).GetIndex (i ).Get ("st" ).MustUint64 () * 1000000 / 8
256
+ user .DeviceLimit = response .Get ("data" ).GetIndex (i ).Get ("dt" ).MustInt ()
258
257
}
259
258
if c .SpeedLimit > 0 {
260
259
user .SpeedLimit = uint64 ((c .SpeedLimit * 1000000 ) / 8 )
@@ -283,8 +282,8 @@ func (c *APIClient) ReportUserTraffic(userTraffic *[]api.UserTraffic) error {
283
282
res , err := c .client .R ().
284
283
SetQueryParam ("node_id" , strconv .Itoa (c .NodeID )).
285
284
SetQueryParams (map [string ]string {
286
- "act" : "submit" ,
287
- "nodetype " : strings .ToLower (c .NodeType ),
285
+ "act" : "submit" ,
286
+ "node_type " : strings .ToLower (c .NodeType ),
288
287
}).
289
288
SetBody (data ).
290
289
ForceContentType ("application/json" ).
@@ -327,8 +326,8 @@ func (c *APIClient) ReportNodeStatus(nodeStatus *api.NodeStatus) (err error) {
327
326
res , err := c .client .R ().
328
327
SetQueryParam ("node_id" , strconv .Itoa (c .NodeID )).
329
328
SetQueryParams (map [string ]string {
330
- "act" : "nodestatus" ,
331
- "nodetype " : strings .ToLower (c .NodeType ),
329
+ "act" : "nodestatus" ,
330
+ "node_type " : strings .ToLower (c .NodeType ),
332
331
}).
333
332
SetBody (systemload ).
334
333
ForceContentType ("application/json" ).
@@ -350,8 +349,8 @@ func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) erro
350
349
res , err := c .client .R ().
351
350
SetQueryParam ("node_id" , strconv .Itoa (c .NodeID )).
352
351
SetQueryParams (map [string ]string {
353
- "act" : "onlineusers" ,
354
- "nodetype " : strings .ToLower (c .NodeType ),
352
+ "act" : "onlineusers" ,
353
+ "node_type " : strings .ToLower (c .NodeType ),
355
354
}).
356
355
SetBody (data ).
357
356
ForceContentType ("application/json" ).
@@ -365,6 +364,26 @@ func (c *APIClient) ReportNodeOnlineUsers(onlineUserList *[]api.OnlineUser) erro
365
364
366
365
// ReportIllegal implements the API interface
367
366
func (c * APIClient ) ReportIllegal (detectResultList * []api.DetectResult ) error {
367
+ data := make ([]IllegalItem , len (* detectResultList ))
368
+ for i , r := range * detectResultList {
369
+ data [i ] = IllegalItem {
370
+ UID : r .UID ,
371
+ }
372
+ }
373
+
374
+ res , err := c .client .R ().
375
+ SetQueryParam ("node_id" , strconv .Itoa (c .NodeID )).
376
+ SetQueryParams (map [string ]string {
377
+ "act" : "illegal" ,
378
+ "node_type" : strings .ToLower (c .NodeType ),
379
+ }).
380
+ SetBody (data ).
381
+ ForceContentType ("application/json" ).
382
+ Post (c .APIHost )
383
+ _ , err = c .parseResponse (res , "" , err )
384
+ if err != nil {
385
+ return err
386
+ }
368
387
return nil
369
388
}
370
389
@@ -423,7 +442,7 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
423
442
var enableTLS bool
424
443
var enableVless bool
425
444
var enableReality bool
426
- var alterID uint16 = 0
445
+ var vlessFlow string
427
446
428
447
tmpInboundInfo := nodeInfoResponse .Get ("inbounds" ).MustArray ()
429
448
marshalByte , _ := json .Marshal (tmpInboundInfo [0 ].(map [string ]interface {}))
@@ -436,6 +455,12 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
436
455
case "ws" :
437
456
path = inboundInfo .Get ("streamSettings" ).Get ("wsSettings" ).Get ("path" ).MustString ()
438
457
host = inboundInfo .Get ("streamSettings" ).Get ("wsSettings" ).Get ("headers" ).Get ("Host" ).MustString ()
458
+ case "httpupgrade" :
459
+ host = inboundInfo .Get ("streamSettings" ).Get ("httpupgradeSettings" ).Get ("Host" ).MustString ()
460
+ path = inboundInfo .Get ("streamSettings" ).Get ("httpupgradeSettings" ).Get ("path" ).MustString ()
461
+ case "splithttp" :
462
+ host = inboundInfo .Get ("streamSettings" ).Get ("splithttpSettings" ).Get ("Host" ).MustString ()
463
+ path = inboundInfo .Get ("streamSettings" ).Get ("splithttpSettings" ).Get ("path" ).MustString ()
439
464
case "grpc" :
440
465
if data , ok := inboundInfo .Get ("streamSettings" ).Get ("grpcSettings" ).CheckGet ("serviceName" ); ok {
441
466
serviceName = data .MustString ()
@@ -448,12 +473,11 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
448
473
header = httpHeader
449
474
}
450
475
}
451
-
452
476
}
453
477
454
478
enableTLS = inboundInfo .Get ("streamSettings" ).Get ("security" ).MustString () == "tls"
455
- enableVless = inboundInfo .Get ("streamSettings " ).Get ( "security" ). MustString () == "reality "
456
- enableReality = enableVless
479
+ enableVless = inboundInfo .Get ("protocol " ).MustString () == "vless "
480
+ enableReality = inboundInfo . Get ( "streamSettings" ). Get ( "security" ). MustString () == "reality"
457
481
458
482
realityConfig := new (api.REALITYConfig )
459
483
if enableVless {
@@ -470,19 +494,26 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
470
494
}
471
495
}
472
496
497
+ // XTLS only supports TLS and REALITY directly for now
498
+ if transportProtocol == "tcp" && enableReality {
499
+ vlessFlow = "xtls-rprx-vision"
500
+ } else {
501
+ vlessFlow = c .VlessFlow
502
+ }
503
+
473
504
// Create GeneralNodeInfo
474
505
// AlterID will be updated after next sync
475
506
nodeInfo := & api.NodeInfo {
476
507
NodeType : c .NodeType ,
477
508
NodeID : c .NodeID ,
478
509
Port : port ,
479
- AlterID : alterID ,
510
+ AlterID : 0 ,
480
511
TransportProtocol : transportProtocol ,
481
512
EnableTLS : enableTLS ,
482
513
Path : path ,
483
514
Host : host ,
484
515
EnableVless : enableVless ,
485
- VlessFlow : c . VlessFlow ,
516
+ VlessFlow : vlessFlow ,
486
517
ServiceName : serviceName ,
487
518
Header : header ,
488
519
EnableREALITY : enableReality ,
0 commit comments