RegisterSystemAPIWithInbounds 注册 system API(含 inboundStore,用于流量同步)。
(mux *http.ServeMux, usersStore users.Store, nodesStore nodes.Store, ibStore inbounds.InboundStore, applyOpts jobs.ApplyOptions)
| 24 | |
| 25 | // RegisterSystemAPIWithInbounds 注册 system API(含 inboundStore,用于流量同步)。 |
| 26 | func 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 | |
| 39 | func (a *systemAPI) handleSyncUsage(w http.ResponseWriter, r *http.Request) { |
| 40 | if r.Method != http.MethodPost { |