github.com/rootless-containers/rootlesskit/v2@v2.3.4/pkg/network/network.go (about)

     1  package network
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/rootless-containers/rootlesskit/v2/pkg/api"
     7  	"github.com/rootless-containers/rootlesskit/v2/pkg/messages"
     8  )
     9  
    10  // ParentDriver is called from the parent namespace
    11  type ParentDriver interface {
    12  	Info(ctx context.Context) (*api.NetworkDriverInfo, error)
    13  	// MTU returns MTU
    14  	MTU() int
    15  	// ConfigureNetwork sets up Slirp, updates msg, and returns destructor function.
    16  	// detachedNetNSPath is set only for the detach-netns mode.
    17  	ConfigureNetwork(childPID int, stateDir, detachedNetNSPath string) (netmsg *messages.ParentInitNetworkDriverCompleted, cleanup func() error, err error)
    18  }
    19  
    20  type ChildDriverInfo struct {
    21  	ConfiguresInterface bool // Driver configures own namespace interface
    22  }
    23  
    24  // ChildDriver is called from the child namespace
    25  type ChildDriver interface {
    26  	// ConfigureNetworkChild is executed in the child's namespaces, excluding detached-netns.
    27  	//
    28  	// netmsg MAY be modified.
    29  	// devName is like "tap" or "eth0"
    30  	ConfigureNetworkChild(netmsg *messages.ParentInitNetworkDriverCompleted, detachedNetNSPath string) (devName string, err error)
    31  
    32  	ChildDriverInfo() (*ChildDriverInfo, error)
    33  }