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

Function StartLoopback

pkg/rpcserver/loopback.go:112–121  ·  view source on GitHub ↗

StartLoopback starts the server on a local address and returns a connection to that address. This function does not add the default DialOptions.

(ctx context.Context, s *grpc.Server, opts ...grpc.DialOption)

Source from the content-addressed store, hash-verified

110// StartLoopback starts the server on a local address and returns a connection to that address.
111// This function does not add the default DialOptions.
112func StartLoopback(ctx context.Context, s *grpc.Server, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
113 lis := newInProcessListener(ctx)
114 go s.Serve(lis)
115 return grpc.Dial(
116 fmt.Sprintf("passthrough:///%v", lis.Addr()),
117 append([]grpc.DialOption{
118 grpc.WithContextDialer(inProcessDialer(lis)),
119 grpc.WithTransportCredentials(&inProcessCredentials{}),
120 }, opts...)...)
121}

Callers 4

TestLoopbackConnFunction · 0.92
TestNewRPCServerFunction · 0.92
setupGRPCMethod · 0.92
NewGRPCServerPeerFunction · 0.92

Calls 4

newInProcessListenerFunction · 0.85
inProcessDialerFunction · 0.85
ServeMethod · 0.80
AddrMethod · 0.65

Tested by 2

TestLoopbackConnFunction · 0.74
TestNewRPCServerFunction · 0.74