2020-07-20 10:28:13 +00:00
|
|
|
// +build !windows
|
|
|
|
|
2018-08-21 15:51:28 +00:00
|
|
|
package network
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/containerd/containerd/oci"
|
|
|
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
|
|
|
)
|
|
|
|
|
|
|
|
func NewHostProvider() Provider {
|
|
|
|
return &host{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type host struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *host) New() (Namespace, error) {
|
|
|
|
return &hostNS{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type hostNS struct {
|
|
|
|
}
|
|
|
|
|
2020-07-18 22:51:00 +00:00
|
|
|
func (h *hostNS) Set(s *specs.Spec) error {
|
|
|
|
return oci.WithHostNamespace(specs.NetworkNamespace)(nil, nil, nil, s)
|
2018-08-21 15:51:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (h *hostNS) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|