예제 #1
0
파일: plugin.go 프로젝트: NetSys/quilt
// Leave destroys a veth pair for the given endpoint ID.
func (d driver) Leave(req *dnet.LeaveRequest) error {
	if err := expectEndpoint(req.EndpointID); err != nil {
		return err
	}

	return network.DelVeth(req.EndpointID)
}
예제 #2
0
파일: plugin.go 프로젝트: NetSys/quilt
// Join creates a Veth pair for the given endpoint ID, returning the interface info.
func (d driver) Join(req *dnet.JoinRequest) (*dnet.JoinResponse, error) {
	if err := expectNoEndpoint(req.EndpointID); err != nil {
		return nil, err
	}

	// We just need to create the Veth and tell Docker where it should go; Docker
	// will take care of moving it into the container and renaming it.
	tempPeer, err := network.AddVeth(req.EndpointID)
	if err != nil {
		network.DelVeth(req.EndpointID) // Just in case
		return nil, err
	}

	resp := &dnet.JoinResponse{}
	resp.InterfaceName = dnet.InterfaceName{SrcName: tempPeer, DstPrefix: innerVeth}
	resp.Gateway = ipdef.GatewayIP.String()
	return resp, nil
}