Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/lattice-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/LatticeNet/lattice-sdk/model"
)

var version = "0.3.3-alpha.1"
var version = "0.3.3-alpha.2"
var compatServerMin = "v0.2.2-alpha.2"
var compatDashboardMin = "v0.2.2-alpha.7"
var compatChannel = "alpha"
Expand Down
4 changes: 2 additions & 2 deletions cmd/lattice-agent/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func (f roundTripFunc) RoundTrip(r *http.Request) (*http.Response, error) {
}

func TestVersionMatchesCurrentRelease(t *testing.T) {
if version != "0.3.3-alpha.1" {
t.Fatalf("version = %q, want 0.3.3-alpha.1", version)
if version != "0.3.3-alpha.2" {
t.Fatalf("version = %q, want 0.3.3-alpha.2", version)
}
}

Expand Down
10 changes: 8 additions & 2 deletions internal/proxyusage/singbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import (
const (
defaultSingBoxStatsPattern = "user>>>"
defaultSingBoxStatsTimeout = 5 * time.Second
// sing-box rewrites its generated StatsService descriptor at runtime to
// the V2Ray-compatible service name. The protobuf messages keep the local
// experimental.v2rayapi package, but clients must invoke this aliased path.
singBoxStatsQueryMethod = "/v2ray.core.app.stats.command.StatsService/QueryStats"
)

// SingBoxStatsSource collects per-user usage from sing-box's experimental
Expand Down Expand Up @@ -125,9 +129,11 @@ func grpcQueryStats(ctx context.Context, addr, pattern string) ([]nameValue, err
return nil, err
}
defer func() { _ = conn.Close() }()
resp, err := singboxstats.NewStatsServiceClient(conn).QueryStats(ctx, &singboxstats.QueryStatsRequest{
request := &singboxstats.QueryStatsRequest{
Patterns: []string{pattern},
})
}
resp := new(singboxstats.QueryStatsResponse)
err = conn.Invoke(ctx, singBoxStatsQueryMethod, request, resp)
if err != nil {
return nil, err
}
Expand Down
7 changes: 6 additions & 1 deletion internal/proxyusage/singbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ func TestGRPCQueryStatsEndToEnd(t *testing.T) {
}}
listener := bufconn.Listen(1 << 20)
server := grpc.NewServer()
singboxstats.RegisterStatsServiceServer(server, fake)
// sing-box aliases the generated service name for V2Ray client
// compatibility. Register the fake under that runtime name so this test
// catches clients that only work against the unaliased generated package.
desc := singboxstats.StatsService_ServiceDesc
desc.ServiceName = "v2ray.core.app.stats.command.StatsService"
server.RegisterService(&desc, fake)
go func() { _ = server.Serve(listener) }()
t.Cleanup(func() {
server.Stop()
Expand Down