vlan

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 9 Imported by: 0

Documentation

Overview

* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	VlanPrefix        = "vlan"
	BridgePrefix      = "docker"
	DefaultBridge     = "docker"
	DefaultIPVlanMode = "l3"
)

Variables

This section is empty.

Functions

func SetupVlanInPureMode

func SetupVlanInPureMode(ethDevice string, vlanId uint16) (netlink.Link, error)

SetupVlan is used in pure veth mode, in this mode, vlan will not attach to bridge device

Types

type NetConf

type NetConf struct {
	types.NetConf
	// The device which has IDC ip address, eg. eth1 or eth1.12 (A vlan device)
	Device string `json:"device"`
	// The candidate devices if device is empty
	Devices []string `json:"devices"`
	// Supports macvlan, bridge or pure(which avoid create unnecessary bridge), default bridge
	Switch string `json:"switch"`
	// Supports ipvlan mode l2, l3, l3s, default is l3
	IpVlanMode string `json:"ipvlan_mode"`

	// Disable creating default bridge
	DisableDefaultBridge *bool `json:"disable_default_bridge"`

	DefaultBridgeName string `json:"default_bridge_name"`

	BridgeNamePrefix string `json:"bridge_name_prefix"`

	VlanNamePrefix string `json:"vlan_name_prefix"`

	GratuitousArpRequest bool `json:"gratuitous_arp_request"`

	MTU int `json:"mtu"`
}

type VlanDriver

type VlanDriver struct {
	//FIXME add a file lock cause we are running multiple processes?
	*NetConf

	// The device id of NetConf.Device or created vlan device
	DeviceIndex int
	// contains filtered or unexported fields
}

func (*VlanDriver) BridgeNameForVlan

func (d *VlanDriver) BridgeNameForVlan(vlanId uint16) string

func (*VlanDriver) CreateBridgeAndVlanDevice

func (d *VlanDriver) CreateBridgeAndVlanDevice(vlanId uint16) (string, error)

#lizard forgives

func (*VlanDriver) GetIPVlanMode

func (d *VlanDriver) GetIPVlanMode() netlink.IPVlanMode

func (*VlanDriver) IPVlanMode

func (d *VlanDriver) IPVlanMode() bool

func (*VlanDriver) Init

func (d *VlanDriver) Init() error

#lizard forgives

func (*VlanDriver) LoadConf

func (d *VlanDriver) LoadConf(bytes []byte) (*NetConf, error)

func (*VlanDriver) MacVlanMode

func (d *VlanDriver) MacVlanMode() bool

func (*VlanDriver) MaybeCreateVlanDevice

func (d *VlanDriver) MaybeCreateVlanDevice(vlanId uint16) error

func (*VlanDriver) PureMode

func (d *VlanDriver) PureMode() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL