-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
- Loading branch information
Vladimir Popov
committed
Feb 1, 2021
1 parent
75b0296
commit 35e4fb2
Showing
4 changed files
with
100 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) 2021 Doc.ai and/or its affiliates. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at: | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package client provides default registry clients | ||
package client | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/networkservicemesh/api/pkg/api/registry" | ||
"google.golang.org/grpc" | ||
|
||
"github.com/networkservicemesh/sdk/pkg/registry/common/refresh" | ||
"github.com/networkservicemesh/sdk/pkg/registry/common/sendfd" | ||
"github.com/networkservicemesh/sdk/pkg/registry/core/chain" | ||
) | ||
|
||
// NewNetworkServiceEndpointClient creates a new default NSE registry client chain | ||
func NewNetworkServiceEndpointClient( | ||
ctx context.Context, | ||
cc grpc.ClientConnInterface, | ||
additionalFunctionality ...registry.NetworkServiceEndpointRegistryClient, | ||
) registry.NetworkServiceEndpointRegistryClient { | ||
return chain.NewNetworkServiceEndpointRegistryClient( | ||
append( | ||
append([]registry.NetworkServiceEndpointRegistryClient{ | ||
refresh.NewNetworkServiceEndpointRegistryClient( | ||
refresh.WithChainContext(ctx)), | ||
sendfd.NewNetworkServiceEndpointRegistryClient(), | ||
}, additionalFunctionality...), | ||
registry.NewNetworkServiceEndpointRegistryClient(cc), | ||
)...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2020-2021 Cisco and/or its affiliates. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at: | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// +build !linux | ||
|
||
package sendfd | ||
|
||
import ( | ||
"github.com/networkservicemesh/api/pkg/api/registry" | ||
|
||
"github.com/networkservicemesh/sdk/pkg/registry/common/null" | ||
) | ||
|
||
// NewNetworkServiceEndpointRegistryClient - creates a Client that if endpoint.Url is of scheme "unix" will replace it | ||
// with an "inode" scheme url and send the FD over the unix socket | ||
func NewNetworkServiceEndpointRegistryClient() registry.NetworkServiceEndpointRegistryClient { | ||
return null.NewNetworkServiceEndpointRegistryClient() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2020-2021 Cisco and/or its affiliates. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at: | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package sendfd provides a registry.NetworkServiceEndpointRegistryClient chain element to convert any unix file socket | ||
// endpoint.URLs into 'inode://${dev}/${ino}' urls and send the fd over the unix file socket. | ||
package sendfd |