MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / New

Function New

pkg/gatewayconfigurationserver/server.go:65–96  ·  view source on GitHub ↗

New returns new *Server.

(c *component.Component, conf *Config)

Source from the content-addressed store, hash-verified

63
64// New returns new *Server.
65func New(c *component.Component, conf *Config) (*Server, error) {
66 ctx := tracer.NewContextWithTracer(c.Context(), tracerNamespace)
67 ctx = log.NewContextWithField(ctx, "namespace", logNamespace)
68
69 gcs := &Server{
70 Component: c,
71 config: conf,
72 }
73
74 bsCUPS, err := cups.NewServer(ctx, c, conf.BasicStation)
75 if err != nil {
76 return nil, err
77 }
78 _ = bsCUPS
79
80 ttkgServer := ttkg.New(c, ttkg.WithConfig(conf.TheThingsKickstarterGateway))
81 _ = ttkgServer
82
83 c.GRPC.RegisterUnaryHook("/ttn.lorawan.v3.GatewayConfigurationService", rpclog.NamespaceHook, rpclog.UnaryNamespaceHook("gatewayconfigurationserver")) //nolint:lll
84 c.GRPC.RegisterUnaryHook("/ttn.lorawan.v3.GatewayConfigurationService", cluster.HookName, c.ClusterAuthUnaryHook())
85
86 ttgcConf := c.GetBaseConfig(ctx).TTGC
87 managedServer, err := managed.New(ctx, c, ttgcConf)
88 if err != nil {
89 return nil, err
90 }
91 gcs.managedServer = managedServer
92
93 c.RegisterGRPC(gcs)
94 c.RegisterWeb(gcs)
95 return gcs, nil
96}

Callers 5

TestNoopManagedGCSServerFunction · 0.92
start.goFile · 0.92
TestWebFunction · 0.70
TestGRPCFunction · 0.70

Calls 13

NewContextWithTracerFunction · 0.92
NewContextWithFieldFunction · 0.92
NewServerFunction · 0.92
NewFunction · 0.92
WithConfigFunction · 0.92
UnaryNamespaceHookFunction · 0.92
NewFunction · 0.92
RegisterUnaryHookMethod · 0.80
ClusterAuthUnaryHookMethod · 0.80
RegisterGRPCMethod · 0.80
RegisterWebMethod · 0.80
ContextMethod · 0.65

Tested by 4

TestNoopManagedGCSServerFunction · 0.74
TestWebFunction · 0.56
TestGRPCFunction · 0.56