2022-12-18 10:31:06 -05:00
|
|
|
package panel
|
|
|
|
|
|
|
|
import (
|
2023-01-12 01:27:06 -05:00
|
|
|
"log"
|
2022-12-18 10:31:06 -05:00
|
|
|
"testing"
|
2023-07-29 06:47:47 -04:00
|
|
|
|
2023-07-29 07:27:15 -04:00
|
|
|
"github.com/InazumaV/V2bX/conf"
|
2022-12-18 10:31:06 -05:00
|
|
|
)
|
|
|
|
|
2023-05-17 21:11:28 -04:00
|
|
|
var client *Client
|
2022-12-22 12:52:44 -05:00
|
|
|
|
|
|
|
func init() {
|
2022-12-18 10:31:06 -05:00
|
|
|
c, err := New(&conf.ApiConfig{
|
|
|
|
APIHost: "http://127.0.0.1",
|
|
|
|
Key: "token",
|
|
|
|
NodeType: "V2ray",
|
|
|
|
NodeID: 1,
|
|
|
|
})
|
|
|
|
if err != nil {
|
2022-12-22 12:52:44 -05:00
|
|
|
log.Panic(err)
|
2022-12-18 10:31:06 -05:00
|
|
|
}
|
2022-12-22 12:52:44 -05:00
|
|
|
client = c
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestClient_GetNodeInfo(t *testing.T) {
|
|
|
|
log.Println(client.GetNodeInfo())
|
2023-06-24 19:49:51 -04:00
|
|
|
log.Println(client.GetNodeInfo())
|
2022-12-22 12:52:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestClient_ReportUserTraffic(t *testing.T) {
|
|
|
|
log.Println(client.ReportUserTraffic([]UserTraffic{
|
|
|
|
{
|
|
|
|
UID: 10372,
|
|
|
|
Upload: 1000,
|
|
|
|
Download: 1000,
|
|
|
|
},
|
|
|
|
}))
|
2022-12-18 10:31:06 -05:00
|
|
|
}
|