Make the example command buildable on macOS
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
parent
616d54c531
commit
236899069c
23
example/cmd/handshaker_linux.go
Normal file
23
example/cmd/handshaker_linux.go
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
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 main
|
||||
|
||||
import ttrpc "github.com/containerd/ttrpc"
|
||||
|
||||
func defaultHandshaker() ttrpc.Handshaker {
|
||||
return ttrpc.UnixSocketRequireSameUser()
|
||||
}
|
25
example/cmd/handshaker_other.go
Normal file
25
example/cmd/handshaker_other.go
Normal file
@ -0,0 +1,25 @@
|
||||
// +build !linux
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
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 main
|
||||
|
||||
import ttrpc "github.com/containerd/ttrpc"
|
||||
|
||||
func defaultHandshaker() ttrpc.Handshaker {
|
||||
return nil
|
||||
}
|
@ -73,7 +73,7 @@ func dumpMetadata(ctx context.Context) {
|
||||
|
||||
func server() error {
|
||||
s, err := ttrpc.NewServer(
|
||||
ttrpc.WithServerHandshaker(ttrpc.UnixSocketRequireSameUser()),
|
||||
ttrpc.WithServerHandshaker(defaultHandshaker()),
|
||||
ttrpc.WithUnaryServerInterceptor(serverIntercept),
|
||||
)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user