MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / RegisterSystemAPIWithInbounds

Function RegisterSystemAPIWithInbounds

internal/serverapi/system.go:26–37  ·  view source on GitHub ↗

RegisterSystemAPIWithInbounds 注册 system API(含 inboundStore,用于流量同步)。

(mux *http.ServeMux, usersStore users.Store, nodesStore nodes.Store, ibStore inbounds.InboundStore, applyOpts jobs.ApplyOptions)

Source from the content-addressed store, hash-verified

24
25// RegisterSystemAPIWithInbounds 注册 system API(含 inboundStore,用于流量同步)。
26func RegisterSystemAPIWithInbounds(mux *http.ServeMux, usersStore users.Store, nodesStore nodes.Store, ibStore inbounds.InboundStore, applyOpts jobs.ApplyOptions) {
27 base := New(nodesStore)
28 api := &systemAPI{
29 users: usersStore,
30 nodes: nodesStore,
31 inboundStore: ibStore,
32 outboundStore: nil, // 调用方可通过 RegisterSystemAPIWithInboundsAndOutbounds 传入
33 base: base,
34 applyOpts: applyOpts,
35 }
36 mux.HandleFunc("/v1/system/sync-usage", api.handleSyncUsage)
37}
38
39func (a *systemAPI) handleSyncUsage(w http.ResponseWriter, r *http.Request) {
40 if r.Method != http.MethodPost {

Callers 1

RunFunction · 0.92

Calls 1

NewFunction · 0.70

Tested by

no test coverage detected