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

Function New

internal/serverapi/api.go:66–76  ·  view source on GitHub ↗
(store nodes.Store)

Source from the content-addressed store, hash-verified

64}
65
66func New(store nodes.Store) *API {
67 return &API{
68 store: store,
69 clientFactory: func(node nodes.Node) *nodes.Client {
70 // 默认 factory:未注入 hub 时返回一个 hub == nil 的 Client;
71 // 所有方法会返回 nodes.ErrHubNotConfigured。生产环境会立即被
72 // SetNodeHub 替换,仅在单测或冷启动早期短暂出现。
73 return nodes.NewClientWithHub(node.ID, nil)
74 },
75 }
76}
77
78func NewWithUsers(nodesStore nodes.Store, usersStore users.Store, inboundStore inbounds.InboundStore, outboundStore outbounds.Store, applyOpts jobs.ApplyOptions, settings UpdateSettingsStore) *API {
79 api := New(nodesStore)

Calls 1

NewClientWithHubFunction · 0.92