Documentation ¶
Overview ¶
Package connect provides chain elements to 'connect' clients
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶ added in v1.1.0
func NewClient() networkservice.NetworkServiceClient
NewClient - returns a connect chain element
func NewServer ¶
func NewServer(client networkservice.NetworkServiceClient, callOptions ...grpc.CallOption) networkservice.NetworkServiceServer
NewServer - returns a connect chain element
Example ¶
ExampleForwarder - example of how to use the connect chain element in a forwarder
package main import ( "context" "github.com/networkservicemesh/api/pkg/api/networkservice" "google.golang.org/grpc" "github.com/networkservicemesh/sdk/pkg/networkservice/chains/client" "github.com/networkservicemesh/sdk/pkg/networkservice/chains/endpoint" "github.com/networkservicemesh/sdk/pkg/networkservice/common/connect" "github.com/networkservicemesh/sdk/pkg/tools/token" ) func main() { var dialOptions []grpc.DialOption var callOptions []grpc.CallOption var additonalClientFunctionality []networkservice.NetworkServiceClient var beforeConnectServer1, beforeConnectServer2 networkservice.NetworkServiceServer var afterConnectServer1, afterConnectServer2 networkservice.NetworkServiceServer var chainCtx context.Context var tokenGenerator token.GeneratorFunc var name string forwarder := endpoint.NewServer( chainCtx, tokenGenerator, endpoint.WithName(name), endpoint.WithAdditionalFunctionality( beforeConnectServer1, beforeConnectServer2, connect.NewServer( client.NewClient( chainCtx, client.WithAdditionalFunctionality(additonalClientFunctionality...), client.WithDialOptions(dialOptions...), client.WithoutRefresh(), client.WithName(name), ), callOptions..., ), afterConnectServer1, afterConnectServer2, ), ) if forwarder != nil { } }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.