repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
docker/libnetwork
controller.go
SandboxContainerWalker
func SandboxContainerWalker(out *Sandbox, containerID string) SandboxWalker { return func(sb Sandbox) bool { if sb.ContainerID() == containerID { *out = sb return true } return false } }
go
func SandboxContainerWalker(out *Sandbox, containerID string) SandboxWalker { return func(sb Sandbox) bool { if sb.ContainerID() == containerID { *out = sb return true } return false } }
[ "func", "SandboxContainerWalker", "(", "out", "*", "Sandbox", ",", "containerID", "string", ")", "SandboxWalker", "{", "return", "func", "(", "sb", "Sandbox", ")", "bool", "{", "if", "sb", ".", "ContainerID", "(", ")", "==", "containerID", "{", "*", "out",...
// SandboxContainerWalker returns a Sandbox Walker function which looks for an existing Sandbox with the passed containerID
[ "SandboxContainerWalker", "returns", "a", "Sandbox", "Walker", "function", "which", "looks", "for", "an", "existing", "Sandbox", "with", "the", "passed", "containerID" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1251-L1259
train
docker/libnetwork
controller.go
SandboxKeyWalker
func SandboxKeyWalker(out *Sandbox, key string) SandboxWalker { return func(sb Sandbox) bool { if sb.Key() == key { *out = sb return true } return false } }
go
func SandboxKeyWalker(out *Sandbox, key string) SandboxWalker { return func(sb Sandbox) bool { if sb.Key() == key { *out = sb return true } return false } }
[ "func", "SandboxKeyWalker", "(", "out", "*", "Sandbox", ",", "key", "string", ")", "SandboxWalker", "{", "return", "func", "(", "sb", "Sandbox", ")", "bool", "{", "if", "sb", ".", "Key", "(", ")", "==", "key", "{", "*", "out", "=", "sb", "\n", "ret...
// SandboxKeyWalker returns a Sandbox Walker function which looks for an existing Sandbox with the passed key
[ "SandboxKeyWalker", "returns", "a", "Sandbox", "Walker", "function", "which", "looks", "for", "an", "existing", "Sandbox", "with", "the", "passed", "key" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1262-L1270
train
docker/libnetwork
controller.go
StartDiagnostic
func (c *controller) StartDiagnostic(port int) { c.Lock() if !c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.EnableDiagnostic("127.0.0.1", port) } c.Unlock() }
go
func (c *controller) StartDiagnostic(port int) { c.Lock() if !c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.EnableDiagnostic("127.0.0.1", port) } c.Unlock() }
[ "func", "(", "c", "*", "controller", ")", "StartDiagnostic", "(", "port", "int", ")", "{", "c", ".", "Lock", "(", ")", "\n", "if", "!", "c", ".", "DiagnosticServer", ".", "IsDiagnosticEnabled", "(", ")", "{", "c", ".", "DiagnosticServer", ".", "EnableD...
// StartDiagnostic start the network dias mode
[ "StartDiagnostic", "start", "the", "network", "dias", "mode" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1335-L1341
train
docker/libnetwork
controller.go
StopDiagnostic
func (c *controller) StopDiagnostic() { c.Lock() if c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.DisableDiagnostic() } c.Unlock() }
go
func (c *controller) StopDiagnostic() { c.Lock() if c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.DisableDiagnostic() } c.Unlock() }
[ "func", "(", "c", "*", "controller", ")", "StopDiagnostic", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "if", "c", ".", "DiagnosticServer", ".", "IsDiagnosticEnabled", "(", ")", "{", "c", ".", "DiagnosticServer", ".", "DisableDiagnostic", "(", ")", ...
// StopDiagnostic start the network dias mode
[ "StopDiagnostic", "start", "the", "network", "dias", "mode" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1344-L1350
train
docker/libnetwork
controller.go
IsDiagnosticEnabled
func (c *controller) IsDiagnosticEnabled() bool { c.Lock() defer c.Unlock() return c.DiagnosticServer.IsDiagnosticEnabled() }
go
func (c *controller) IsDiagnosticEnabled() bool { c.Lock() defer c.Unlock() return c.DiagnosticServer.IsDiagnosticEnabled() }
[ "func", "(", "c", "*", "controller", ")", "IsDiagnosticEnabled", "(", ")", "bool", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "DiagnosticServer", ".", "IsDiagnosticEnabled", "(", ")", "\n", ...
// IsDiagnosticEnabled returns true if the dias is enabled
[ "IsDiagnosticEnabled", "returns", "true", "if", "the", "dias", "is", "enabled" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1353-L1357
train
docker/libnetwork
drivers/overlay/ov_network.go
destroySandbox
func (n *network) destroySandbox() { if n.sbox != nil { for _, iface := range n.sbox.Info().Interfaces() { if err := iface.Remove(); err != nil { logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err) } } for _, s := range n.subnets { if hostMode { if err := removeFilters(n.id[:1...
go
func (n *network) destroySandbox() { if n.sbox != nil { for _, iface := range n.sbox.Info().Interfaces() { if err := iface.Remove(); err != nil { logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err) } } for _, s := range n.subnets { if hostMode { if err := removeFilters(n.id[:1...
[ "func", "(", "n", "*", "network", ")", "destroySandbox", "(", ")", "{", "if", "n", ".", "sbox", "!=", "nil", "{", "for", "_", ",", "iface", ":=", "range", "n", ".", "sbox", ".", "Info", "(", ")", ".", "Interfaces", "(", ")", "{", "if", "err", ...
// to be called while holding network lock
[ "to", "be", "called", "while", "holding", "network", "lock" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/ov_network.go#L374-L412
train
docker/libnetwork
drivers/overlay/ov_network.go
initSubnetSandbox
func (n *network) initSubnetSandbox(s *subnet, restore bool) error { brName := n.generateBridgeName(s) vxlanName := n.generateVxlanName(s) if restore { if err := n.restoreSubnetSandbox(s, brName, vxlanName); err != nil { return err } } else { if err := n.setupSubnetSandbox(s, brName, vxlanName); err != ni...
go
func (n *network) initSubnetSandbox(s *subnet, restore bool) error { brName := n.generateBridgeName(s) vxlanName := n.generateVxlanName(s) if restore { if err := n.restoreSubnetSandbox(s, brName, vxlanName); err != nil { return err } } else { if err := n.setupSubnetSandbox(s, brName, vxlanName); err != ni...
[ "func", "(", "n", "*", "network", ")", "initSubnetSandbox", "(", "s", "*", "subnet", ",", "restore", "bool", ")", "error", "{", "brName", ":=", "n", ".", "generateBridgeName", "(", "s", ")", "\n", "vxlanName", ":=", "n", ".", "generateVxlanName", "(", ...
// Must be called with the network lock
[ "Must", "be", "called", "with", "the", "network", "lock" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/ov_network.go#L662-L680
train
docker/libnetwork
drivers/overlay/ov_network.go
restoreNetworkFromStore
func (d *driver) restoreNetworkFromStore(nid string) *network { n := d.getNetworkFromStore(nid) if n != nil { n.driver = d n.endpoints = endpointTable{} d.networks[nid] = n } return n }
go
func (d *driver) restoreNetworkFromStore(nid string) *network { n := d.getNetworkFromStore(nid) if n != nil { n.driver = d n.endpoints = endpointTable{} d.networks[nid] = n } return n }
[ "func", "(", "d", "*", "driver", ")", "restoreNetworkFromStore", "(", "nid", "string", ")", "*", "network", "{", "n", ":=", "d", ".", "getNetworkFromStore", "(", "nid", ")", "\n", "if", "n", "!=", "nil", "{", "n", ".", "driver", "=", "d", "\n", "n"...
// Restore a network from the store to the driver if it is present. // Must be called with the driver locked!
[ "Restore", "a", "network", "from", "the", "store", "to", "the", "driver", "if", "it", "is", "present", ".", "Must", "be", "called", "with", "the", "driver", "locked!" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/ov_network.go#L863-L871
train
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
createNetwork
func (d *driver) createNetwork(config *configuration) error { networkList := d.getNetworks() for _, nw := range networkList { if config.Parent == nw.config.Parent { return fmt.Errorf("network %s is already using parent interface %s", getDummyName(stringid.TruncateID(nw.config.ID)), config.Parent) } } if ...
go
func (d *driver) createNetwork(config *configuration) error { networkList := d.getNetworks() for _, nw := range networkList { if config.Parent == nw.config.Parent { return fmt.Errorf("network %s is already using parent interface %s", getDummyName(stringid.TruncateID(nw.config.ID)), config.Parent) } } if ...
[ "func", "(", "d", "*", "driver", ")", "createNetwork", "(", "config", "*", "configuration", ")", "error", "{", "networkList", ":=", "d", ".", "getNetworks", "(", ")", "\n", "for", "_", ",", "nw", ":=", "range", "networkList", "{", "if", "config", ".", ...
// createNetwork is used by new network callbacks and persistent network cache
[ "createNetwork", "is", "used", "by", "new", "network", "callbacks", "and", "persistent", "network", "cache" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L79-L121
train
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
DeleteNetwork
func (d *driver) DeleteNetwork(nid string) error { defer osl.InitOSContext()() n := d.network(nid) if n == nil { return fmt.Errorf("network id %s not found", nid) } // if the driver created the slave interface, delete it, otherwise leave it if ok := n.config.CreatedSlaveLink; ok { // if the interface exists, ...
go
func (d *driver) DeleteNetwork(nid string) error { defer osl.InitOSContext()() n := d.network(nid) if n == nil { return fmt.Errorf("network id %s not found", nid) } // if the driver created the slave interface, delete it, otherwise leave it if ok := n.config.CreatedSlaveLink; ok { // if the interface exists, ...
[ "func", "(", "d", "*", "driver", ")", "DeleteNetwork", "(", "nid", "string", ")", "error", "{", "defer", "osl", ".", "InitOSContext", "(", ")", "(", ")", "\n", "n", ":=", "d", ".", "network", "(", "nid", ")", "\n", "if", "n", "==", "nil", "{", ...
// DeleteNetwork the network for the specified driver type
[ "DeleteNetwork", "the", "network", "for", "the", "specified", "driver", "type" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L124-L170
train
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
parseNetworkOptions
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) { var ( err error config = &configuration{} ) // parse generic labels first if genData, ok := option[netlabel.GenericData]; ok && genData != nil { if config, err = parseNetworkGenericOptions(genData); err != nil { return...
go
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) { var ( err error config = &configuration{} ) // parse generic labels first if genData, ok := option[netlabel.GenericData]; ok && genData != nil { if config, err = parseNetworkGenericOptions(genData); err != nil { return...
[ "func", "parseNetworkOptions", "(", "id", "string", ",", "option", "options", ".", "Generic", ")", "(", "*", "configuration", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "config", "=", "&", "configuration", "{", "}", "\n", ")", "\n", "// ...
// parseNetworkOptions parse docker network options
[ "parseNetworkOptions", "parse", "docker", "network", "options" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L173-L191
train
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
parseNetworkGenericOptions
func parseNetworkGenericOptions(data interface{}) (*configuration, error) { var ( err error config *configuration ) switch opt := data.(type) { case *configuration: config = opt case map[string]string: config = &configuration{} err = config.fromOptions(opt) case options.Generic: var opaqueConfig in...
go
func parseNetworkGenericOptions(data interface{}) (*configuration, error) { var ( err error config *configuration ) switch opt := data.(type) { case *configuration: config = opt case map[string]string: config = &configuration{} err = config.fromOptions(opt) case options.Generic: var opaqueConfig in...
[ "func", "parseNetworkGenericOptions", "(", "data", "interface", "{", "}", ")", "(", "*", "configuration", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "config", "*", "configuration", "\n", ")", "\n", "switch", "opt", ":=", "data", ".", "(", ...
// parseNetworkGenericOptions parse generic driver docker network options
[ "parseNetworkGenericOptions", "parse", "generic", "driver", "docker", "network", "options" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L194-L214
train
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
fromOptions
func (config *configuration) fromOptions(labels map[string]string) error { for label, value := range labels { switch label { case parentOpt: // parse driver option '-o parent' config.Parent = value case driverModeOpt: // parse driver option '-o ipvlan_mode' config.IpvlanMode = value } } return ni...
go
func (config *configuration) fromOptions(labels map[string]string) error { for label, value := range labels { switch label { case parentOpt: // parse driver option '-o parent' config.Parent = value case driverModeOpt: // parse driver option '-o ipvlan_mode' config.IpvlanMode = value } } return ni...
[ "func", "(", "config", "*", "configuration", ")", "fromOptions", "(", "labels", "map", "[", "string", "]", "string", ")", "error", "{", "for", "label", ",", "value", ":=", "range", "labels", "{", "switch", "label", "{", "case", "parentOpt", ":", "// pars...
// fromOptions binds the generic options to networkConfiguration to cache
[ "fromOptions", "binds", "the", "generic", "options", "to", "networkConfiguration", "to", "cache" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L217-L229
train
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
processIPAM
func (config *configuration) processIPAM(id string, ipamV4Data, ipamV6Data []driverapi.IPAMData) error { if len(ipamV4Data) > 0 { for _, ipd := range ipamV4Data { s := &ipv4Subnet{ SubnetIP: ipd.Pool.String(), GwIP: ipd.Gateway.String(), } config.Ipv4Subnets = append(config.Ipv4Subnets, s) } ...
go
func (config *configuration) processIPAM(id string, ipamV4Data, ipamV6Data []driverapi.IPAMData) error { if len(ipamV4Data) > 0 { for _, ipd := range ipamV4Data { s := &ipv4Subnet{ SubnetIP: ipd.Pool.String(), GwIP: ipd.Gateway.String(), } config.Ipv4Subnets = append(config.Ipv4Subnets, s) } ...
[ "func", "(", "config", "*", "configuration", ")", "processIPAM", "(", "id", "string", ",", "ipamV4Data", ",", "ipamV6Data", "[", "]", "driverapi", ".", "IPAMData", ")", "error", "{", "if", "len", "(", "ipamV4Data", ")", ">", "0", "{", "for", "_", ",", ...
// processIPAM parses v4 and v6 IP information and binds it to the network configuration
[ "processIPAM", "parses", "v4", "and", "v6", "IP", "information", "and", "binds", "it", "to", "the", "network", "configuration" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L232-L252
train
docker/libnetwork
hostdiscovery/hostdiscovery.go
NewHostDiscovery
func NewHostDiscovery(watcher discovery.Watcher) HostDiscovery { return &hostDiscovery{watcher: watcher, nodes: mapset.NewSet(), stopChan: make(chan struct{})} }
go
func NewHostDiscovery(watcher discovery.Watcher) HostDiscovery { return &hostDiscovery{watcher: watcher, nodes: mapset.NewSet(), stopChan: make(chan struct{})} }
[ "func", "NewHostDiscovery", "(", "watcher", "discovery", ".", "Watcher", ")", "HostDiscovery", "{", "return", "&", "hostDiscovery", "{", "watcher", ":", "watcher", ",", "nodes", ":", "mapset", ".", "NewSet", "(", ")", ",", "stopChan", ":", "make", "(", "ch...
// NewHostDiscovery function creates a host discovery object
[ "NewHostDiscovery", "function", "creates", "a", "host", "discovery", "object" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/hostdiscovery/hostdiscovery.go#L33-L35
train
docker/libnetwork
driverapi/ipamdata.go
MarshalJSON
func (i *IPAMData) MarshalJSON() ([]byte, error) { m := map[string]interface{}{} m["AddressSpace"] = i.AddressSpace if i.Pool != nil { m["Pool"] = i.Pool.String() } if i.Gateway != nil { m["Gateway"] = i.Gateway.String() } if i.AuxAddresses != nil { am := make(map[string]string, len(i.AuxAddresses)) for ...
go
func (i *IPAMData) MarshalJSON() ([]byte, error) { m := map[string]interface{}{} m["AddressSpace"] = i.AddressSpace if i.Pool != nil { m["Pool"] = i.Pool.String() } if i.Gateway != nil { m["Gateway"] = i.Gateway.String() } if i.AuxAddresses != nil { am := make(map[string]string, len(i.AuxAddresses)) for ...
[ "func", "(", "i", "*", "IPAMData", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "m", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "m", "[", "\"", "\"", "]", "=", "i", ".", "AddressSpa...
// MarshalJSON encodes IPAMData into json message
[ "MarshalJSON", "encodes", "IPAMData", "into", "json", "message" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/driverapi/ipamdata.go#L12-L29
train
docker/libnetwork
driverapi/ipamdata.go
UnmarshalJSON
func (i *IPAMData) UnmarshalJSON(data []byte) error { var ( m map[string]interface{} err error ) if err := json.Unmarshal(data, &m); err != nil { return err } i.AddressSpace = m["AddressSpace"].(string) if v, ok := m["Pool"]; ok { if i.Pool, err = types.ParseCIDR(v.(string)); err != nil { return err ...
go
func (i *IPAMData) UnmarshalJSON(data []byte) error { var ( m map[string]interface{} err error ) if err := json.Unmarshal(data, &m); err != nil { return err } i.AddressSpace = m["AddressSpace"].(string) if v, ok := m["Pool"]; ok { if i.Pool, err = types.ParseCIDR(v.(string)); err != nil { return err ...
[ "func", "(", "i", "*", "IPAMData", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "(", "m", "map", "[", "string", "]", "interface", "{", "}", "\n", "err", "error", "\n", ")", "\n", "if", "err", ":=", "json", ".", ...
// UnmarshalJSON decodes a json message into IPAMData
[ "UnmarshalJSON", "decodes", "a", "json", "message", "into", "IPAMData" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/driverapi/ipamdata.go#L32-L65
train
docker/libnetwork
driverapi/ipamdata.go
Validate
func (i *IPAMData) Validate() error { var isV6 bool if i.Pool == nil { return types.BadRequestErrorf("invalid pool") } if i.Gateway == nil { return types.BadRequestErrorf("invalid gateway address") } isV6 = i.IsV6() if isV6 && i.Gateway.IP.To4() != nil || !isV6 && i.Gateway.IP.To4() == nil { return types.B...
go
func (i *IPAMData) Validate() error { var isV6 bool if i.Pool == nil { return types.BadRequestErrorf("invalid pool") } if i.Gateway == nil { return types.BadRequestErrorf("invalid gateway address") } isV6 = i.IsV6() if isV6 && i.Gateway.IP.To4() != nil || !isV6 && i.Gateway.IP.To4() == nil { return types.B...
[ "func", "(", "i", "*", "IPAMData", ")", "Validate", "(", ")", "error", "{", "var", "isV6", "bool", "\n", "if", "i", ".", "Pool", "==", "nil", "{", "return", "types", ".", "BadRequestErrorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "i", ".", ...
// Validate checks whether the IPAMData structure contains congruent data
[ "Validate", "checks", "whether", "the", "IPAMData", "structure", "contains", "congruent", "data" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/driverapi/ipamdata.go#L68-L94
train
docker/libnetwork
default_gateway.go
clearDefaultGW
func (sb *sandbox) clearDefaultGW() error { var ep *endpoint if ep = sb.getEndpointInGWNetwork(); ep == nil { return nil } if err := ep.sbLeave(sb, false); err != nil { return fmt.Errorf("container %s: endpoint leaving GW Network failed: %v", sb.containerID, err) } if err := ep.Delete(false); err != nil { ...
go
func (sb *sandbox) clearDefaultGW() error { var ep *endpoint if ep = sb.getEndpointInGWNetwork(); ep == nil { return nil } if err := ep.sbLeave(sb, false); err != nil { return fmt.Errorf("container %s: endpoint leaving GW Network failed: %v", sb.containerID, err) } if err := ep.Delete(false); err != nil { ...
[ "func", "(", "sb", "*", "sandbox", ")", "clearDefaultGW", "(", ")", "error", "{", "var", "ep", "*", "endpoint", "\n\n", "if", "ep", "=", "sb", ".", "getEndpointInGWNetwork", "(", ")", ";", "ep", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "...
// If present, detach and remove the endpoint connecting the sandbox to the default gw network.
[ "If", "present", "detach", "and", "remove", "the", "endpoint", "connecting", "the", "sandbox", "to", "the", "default", "gw", "network", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L98-L111
train
docker/libnetwork
default_gateway.go
needDefaultGW
func (sb *sandbox) needDefaultGW() bool { var needGW bool for _, ep := range sb.getConnectedEndpoints() { if ep.endpointInGWNetwork() { continue } if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if ep.getNetwork().Internal() { continue } // During stale san...
go
func (sb *sandbox) needDefaultGW() bool { var needGW bool for _, ep := range sb.getConnectedEndpoints() { if ep.endpointInGWNetwork() { continue } if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if ep.getNetwork().Internal() { continue } // During stale san...
[ "func", "(", "sb", "*", "sandbox", ")", "needDefaultGW", "(", ")", "bool", "{", "var", "needGW", "bool", "\n\n", "for", "_", ",", "ep", ":=", "range", "sb", ".", "getConnectedEndpoints", "(", ")", "{", "if", "ep", ".", "endpointInGWNetwork", "(", ")", ...
// Evaluate whether the sandbox requires a default gateway based // on the endpoints to which it is connected. It does not account // for the default gateway network endpoint.
[ "Evaluate", "whether", "the", "sandbox", "requires", "a", "default", "gateway", "based", "on", "the", "endpoints", "to", "which", "it", "is", "connected", ".", "It", "does", "not", "account", "for", "the", "default", "gateway", "network", "endpoint", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L117-L147
train
docker/libnetwork
default_gateway.go
defaultGwNetwork
func (c *controller) defaultGwNetwork() (Network, error) { procGwNetwork <- true defer func() { <-procGwNetwork }() n, err := c.NetworkByName(libnGWNetwork) if _, ok := err.(types.NotFoundError); ok { n, err = c.createGWNetwork() } return n, err }
go
func (c *controller) defaultGwNetwork() (Network, error) { procGwNetwork <- true defer func() { <-procGwNetwork }() n, err := c.NetworkByName(libnGWNetwork) if _, ok := err.(types.NotFoundError); ok { n, err = c.createGWNetwork() } return n, err }
[ "func", "(", "c", "*", "controller", ")", "defaultGwNetwork", "(", ")", "(", "Network", ",", "error", ")", "{", "procGwNetwork", "<-", "true", "\n", "defer", "func", "(", ")", "{", "<-", "procGwNetwork", "}", "(", ")", "\n\n", "n", ",", "err", ":=", ...
// Looks for the default gw network and creates it if not there. // Parallel executions are serialized.
[ "Looks", "for", "the", "default", "gw", "network", "and", "creates", "it", "if", "not", "there", ".", "Parallel", "executions", "are", "serialized", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L179-L188
train
docker/libnetwork
default_gateway.go
getGatewayEndpoint
func (sb *sandbox) getGatewayEndpoint() *endpoint { for _, ep := range sb.getConnectedEndpoints() { if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if len(ep.Gateway()) != 0 { return ep } } return nil }
go
func (sb *sandbox) getGatewayEndpoint() *endpoint { for _, ep := range sb.getConnectedEndpoints() { if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if len(ep.Gateway()) != 0 { return ep } } return nil }
[ "func", "(", "sb", "*", "sandbox", ")", "getGatewayEndpoint", "(", ")", "*", "endpoint", "{", "for", "_", ",", "ep", ":=", "range", "sb", ".", "getConnectedEndpoints", "(", ")", "{", "if", "ep", ".", "getNetwork", "(", ")", ".", "Type", "(", ")", "...
// Returns the endpoint which is providing external connectivity to the sandbox
[ "Returns", "the", "endpoint", "which", "is", "providing", "external", "connectivity", "to", "the", "sandbox" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L191-L201
train
docker/libnetwork
netutils/utils.go
CheckNameserverOverlaps
func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error { if len(nameservers) > 0 { for _, ns := range nameservers { _, nsNetwork, err := net.ParseCIDR(ns) if err != nil { return err } if NetworkOverlaps(toCheck, nsNetwork) { return ErrNetworkOverlapsWithNameservers } } ...
go
func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error { if len(nameservers) > 0 { for _, ns := range nameservers { _, nsNetwork, err := net.ParseCIDR(ns) if err != nil { return err } if NetworkOverlaps(toCheck, nsNetwork) { return ErrNetworkOverlapsWithNameservers } } ...
[ "func", "CheckNameserverOverlaps", "(", "nameservers", "[", "]", "string", ",", "toCheck", "*", "net", ".", "IPNet", ")", "error", "{", "if", "len", "(", "nameservers", ")", ">", "0", "{", "for", "_", ",", "ns", ":=", "range", "nameservers", "{", "_", ...
// CheckNameserverOverlaps checks whether the passed network overlaps with any of the nameservers
[ "CheckNameserverOverlaps", "checks", "whether", "the", "passed", "network", "overlaps", "with", "any", "of", "the", "nameservers" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L27-L40
train
docker/libnetwork
netutils/utils.go
NetworkOverlaps
func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool { return netX.Contains(netY.IP) || netY.Contains(netX.IP) }
go
func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool { return netX.Contains(netY.IP) || netY.Contains(netX.IP) }
[ "func", "NetworkOverlaps", "(", "netX", "*", "net", ".", "IPNet", ",", "netY", "*", "net", ".", "IPNet", ")", "bool", "{", "return", "netX", ".", "Contains", "(", "netY", ".", "IP", ")", "||", "netY", ".", "Contains", "(", "netX", ".", "IP", ")", ...
// NetworkOverlaps detects overlap between one IPNet and another
[ "NetworkOverlaps", "detects", "overlap", "between", "one", "IPNet", "and", "another" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L43-L45
train
docker/libnetwork
netutils/utils.go
NetworkRange
func NetworkRange(network *net.IPNet) (net.IP, net.IP) { if network == nil { return nil, nil } firstIP := network.IP.Mask(network.Mask) lastIP := types.GetIPCopy(firstIP) for i := 0; i < len(firstIP); i++ { lastIP[i] = firstIP[i] | ^network.Mask[i] } if network.IP.To4() != nil { firstIP = firstIP.To4() ...
go
func NetworkRange(network *net.IPNet) (net.IP, net.IP) { if network == nil { return nil, nil } firstIP := network.IP.Mask(network.Mask) lastIP := types.GetIPCopy(firstIP) for i := 0; i < len(firstIP); i++ { lastIP[i] = firstIP[i] | ^network.Mask[i] } if network.IP.To4() != nil { firstIP = firstIP.To4() ...
[ "func", "NetworkRange", "(", "network", "*", "net", ".", "IPNet", ")", "(", "net", ".", "IP", ",", "net", ".", "IP", ")", "{", "if", "network", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "firstIP", ":=", "network", ".", "IP...
// NetworkRange calculates the first and last IP addresses in an IPNet
[ "NetworkRange", "calculates", "the", "first", "and", "last", "IP", "addresses", "in", "an", "IPNet" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L48-L65
train
docker/libnetwork
netutils/utils.go
GetIfaceAddr
func GetIfaceAddr(name string) (net.Addr, []net.Addr, error) { iface, err := net.InterfaceByName(name) if err != nil { return nil, nil, err } addrs, err := iface.Addrs() if err != nil { return nil, nil, err } var addrs4 []net.Addr var addrs6 []net.Addr for _, addr := range addrs { ip := (addr.(*net.IPNet...
go
func GetIfaceAddr(name string) (net.Addr, []net.Addr, error) { iface, err := net.InterfaceByName(name) if err != nil { return nil, nil, err } addrs, err := iface.Addrs() if err != nil { return nil, nil, err } var addrs4 []net.Addr var addrs6 []net.Addr for _, addr := range addrs { ip := (addr.(*net.IPNet...
[ "func", "GetIfaceAddr", "(", "name", "string", ")", "(", "net", ".", "Addr", ",", "[", "]", "net", ".", "Addr", ",", "error", ")", "{", "iface", ",", "err", ":=", "net", ".", "InterfaceByName", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{...
// GetIfaceAddr returns the first IPv4 address and slice of IPv6 addresses for the specified network interface
[ "GetIfaceAddr", "returns", "the", "first", "IPv4", "address", "and", "slice", "of", "IPv6", "addresses", "for", "the", "specified", "network", "interface" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L68-L95
train
docker/libnetwork
netutils/utils.go
GenerateRandomName
func GenerateRandomName(prefix string, size int) (string, error) { id := make([]byte, 32) if _, err := io.ReadFull(rand.Reader, id); err != nil { return "", err } return prefix + hex.EncodeToString(id)[:size], nil }
go
func GenerateRandomName(prefix string, size int) (string, error) { id := make([]byte, 32) if _, err := io.ReadFull(rand.Reader, id); err != nil { return "", err } return prefix + hex.EncodeToString(id)[:size], nil }
[ "func", "GenerateRandomName", "(", "prefix", "string", ",", "size", "int", ")", "(", "string", ",", "error", ")", "{", "id", ":=", "make", "(", "[", "]", "byte", ",", "32", ")", "\n", "if", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "rand...
// GenerateRandomName returns a new name joined with a prefix. This size // specified is used to truncate the randomly generated value
[ "GenerateRandomName", "returns", "a", "new", "name", "joined", "with", "a", "prefix", ".", "This", "size", "specified", "is", "used", "to", "truncate", "the", "randomly", "generated", "value" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L129-L135
train
docker/libnetwork
netutils/utils.go
ReverseIP
func ReverseIP(IP string) string { var reverseIP []string if net.ParseIP(IP).To4() != nil { reverseIP = strings.Split(IP, ".") l := len(reverseIP) for i, j := 0, l-1; i < l/2; i, j = i+1, j-1 { reverseIP[i], reverseIP[j] = reverseIP[j], reverseIP[i] } } else { reverseIP = strings.Split(IP, ":") // R...
go
func ReverseIP(IP string) string { var reverseIP []string if net.ParseIP(IP).To4() != nil { reverseIP = strings.Split(IP, ".") l := len(reverseIP) for i, j := 0, l-1; i < l/2; i, j = i+1, j-1 { reverseIP[i], reverseIP[j] = reverseIP[j], reverseIP[i] } } else { reverseIP = strings.Split(IP, ":") // R...
[ "func", "ReverseIP", "(", "IP", "string", ")", "string", "{", "var", "reverseIP", "[", "]", "string", "\n\n", "if", "net", ".", "ParseIP", "(", "IP", ")", ".", "To4", "(", ")", "!=", "nil", "{", "reverseIP", "=", "strings", ".", "Split", "(", "IP",...
// ReverseIP accepts a V4 or V6 IP string in the canonical form and returns a reversed IP in // the dotted decimal form . This is used to setup the IP to service name mapping in the optimal // way for the DNS PTR queries.
[ "ReverseIP", "accepts", "a", "V4", "or", "V6", "IP", "string", "in", "the", "canonical", "form", "and", "returns", "a", "reversed", "IP", "in", "the", "dotted", "decimal", "form", ".", "This", "is", "used", "to", "setup", "the", "IP", "to", "service", ...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L140-L171
train
docker/libnetwork
ipvs/netlink.go
assembleService
func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) { var s Service for _, attr := range attrs { attrType := int(attr.Attr.Type) switch attrType { case ipvsSvcAttrAddressFamily: s.AddressFamily = native.Uint16(attr.Value) case ipvsSvcAttrProtocol: s.Protocol = native.Uint16(att...
go
func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) { var s Service for _, attr := range attrs { attrType := int(attr.Attr.Type) switch attrType { case ipvsSvcAttrAddressFamily: s.AddressFamily = native.Uint16(attr.Value) case ipvsSvcAttrProtocol: s.Protocol = native.Uint16(att...
[ "func", "assembleService", "(", "attrs", "[", "]", "syscall", ".", "NetlinkRouteAttr", ")", "(", "*", "Service", ",", "error", ")", "{", "var", "s", "Service", "\n\n", "for", "_", ",", "attr", ":=", "range", "attrs", "{", "attrType", ":=", "int", "(", ...
// assembleService assembles a services back from a hain of netlink attributes
[ "assembleService", "assembles", "a", "services", "back", "from", "a", "hain", "of", "netlink", "attributes" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L315-L357
train
docker/libnetwork
ipvs/netlink.go
parseService
func (i *Handle) parseService(msg []byte) (*Service, error) { var s *Service //Remove General header for this message and parse the NetLink message hdr := deserializeGenlMsg(msg) NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():]) if err != nil { return nil, err } if len(NetLinkAttrs) == 0 { return nil...
go
func (i *Handle) parseService(msg []byte) (*Service, error) { var s *Service //Remove General header for this message and parse the NetLink message hdr := deserializeGenlMsg(msg) NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():]) if err != nil { return nil, err } if len(NetLinkAttrs) == 0 { return nil...
[ "func", "(", "i", "*", "Handle", ")", "parseService", "(", "msg", "[", "]", "byte", ")", "(", "*", "Service", ",", "error", ")", "{", "var", "s", "*", "Service", "\n\n", "//Remove General header for this message and parse the NetLink message", "hdr", ":=", "de...
// parseService given a ipvs netlink response this function will respond with a valid service entry, an error otherwise
[ "parseService", "given", "a", "ipvs", "netlink", "response", "this", "function", "will", "respond", "with", "a", "valid", "service", "entry", "an", "error", "otherwise" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L360-L387
train
docker/libnetwork
ipvs/netlink.go
doCmdWithoutAttr
func (i *Handle) doCmdWithoutAttr(cmd uint8) ([][]byte, error) { req := newIPVSRequest(cmd) req.Seq = atomic.AddUint32(&i.seq, 1) return execute(i.sock, req, 0) }
go
func (i *Handle) doCmdWithoutAttr(cmd uint8) ([][]byte, error) { req := newIPVSRequest(cmd) req.Seq = atomic.AddUint32(&i.seq, 1) return execute(i.sock, req, 0) }
[ "func", "(", "i", "*", "Handle", ")", "doCmdWithoutAttr", "(", "cmd", "uint8", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "req", ":=", "newIPVSRequest", "(", "cmd", ")", "\n", "req", ".", "Seq", "=", "atomic", ".", "AddUint32", ...
// doCmdWithoutAttr a simple wrapper of netlink socket execute command
[ "doCmdWithoutAttr", "a", "simple", "wrapper", "of", "netlink", "socket", "execute", "command" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L410-L414
train
docker/libnetwork
ipvs/netlink.go
parseDestination
func (i *Handle) parseDestination(msg []byte) (*Destination, error) { var dst *Destination //Remove General header for this message hdr := deserializeGenlMsg(msg) NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():]) if err != nil { return nil, err } if len(NetLinkAttrs) == 0 { return nil, fmt.Errorf("err...
go
func (i *Handle) parseDestination(msg []byte) (*Destination, error) { var dst *Destination //Remove General header for this message hdr := deserializeGenlMsg(msg) NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():]) if err != nil { return nil, err } if len(NetLinkAttrs) == 0 { return nil, fmt.Errorf("err...
[ "func", "(", "i", "*", "Handle", ")", "parseDestination", "(", "msg", "[", "]", "byte", ")", "(", "*", "Destination", ",", "error", ")", "{", "var", "dst", "*", "Destination", "\n\n", "//Remove General header for this message", "hdr", ":=", "deserializeGenlMsg...
// parseDestination given a ipvs netlink response this function will respond with a valid destination entry, an error otherwise
[ "parseDestination", "given", "a", "ipvs", "netlink", "response", "this", "function", "will", "respond", "with", "a", "valid", "destination", "entry", "an", "error", "otherwise" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L459-L485
train
docker/libnetwork
ipvs/netlink.go
parseConfig
func (i *Handle) parseConfig(msg []byte) (*Config, error) { var c Config //Remove General header for this message hdr := deserializeGenlMsg(msg) attrs, err := nl.ParseRouteAttr(msg[hdr.Len():]) if err != nil { return nil, err } for _, attr := range attrs { attrType := int(attr.Attr.Type) switch attrType ...
go
func (i *Handle) parseConfig(msg []byte) (*Config, error) { var c Config //Remove General header for this message hdr := deserializeGenlMsg(msg) attrs, err := nl.ParseRouteAttr(msg[hdr.Len():]) if err != nil { return nil, err } for _, attr := range attrs { attrType := int(attr.Attr.Type) switch attrType ...
[ "func", "(", "i", "*", "Handle", ")", "parseConfig", "(", "msg", "[", "]", "byte", ")", "(", "*", "Config", ",", "error", ")", "{", "var", "c", "Config", "\n\n", "//Remove General header for this message", "hdr", ":=", "deserializeGenlMsg", "(", "msg", ")"...
// parseConfig given a ipvs netlink response this function will respond with a valid config entry, an error otherwise
[ "parseConfig", "given", "a", "ipvs", "netlink", "response", "this", "function", "will", "respond", "with", "a", "valid", "config", "entry", "an", "error", "otherwise" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L508-L531
train
docker/libnetwork
ipvs/netlink.go
doGetConfigCmd
func (i *Handle) doGetConfigCmd() (*Config, error) { msg, err := i.doCmdWithoutAttr(ipvsCmdGetConfig) if err != nil { return nil, err } res, err := i.parseConfig(msg[0]) if err != nil { return res, err } return res, nil }
go
func (i *Handle) doGetConfigCmd() (*Config, error) { msg, err := i.doCmdWithoutAttr(ipvsCmdGetConfig) if err != nil { return nil, err } res, err := i.parseConfig(msg[0]) if err != nil { return res, err } return res, nil }
[ "func", "(", "i", "*", "Handle", ")", "doGetConfigCmd", "(", ")", "(", "*", "Config", ",", "error", ")", "{", "msg", ",", "err", ":=", "i", ".", "doCmdWithoutAttr", "(", "ipvsCmdGetConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ...
// doGetConfigCmd a wrapper function to be used by GetConfig
[ "doGetConfigCmd", "a", "wrapper", "function", "to", "be", "used", "by", "GetConfig" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L534-L545
train
docker/libnetwork
ipvs/netlink.go
doSetConfigCmd
func (i *Handle) doSetConfigCmd(c *Config) error { req := newIPVSRequest(ipvsCmdSetConfig) req.Seq = atomic.AddUint32(&i.seq, 1) req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCP, nl.Uint32Attr(uint32(c.TimeoutTCP.Seconds())))) req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCPFin, nl.Uint32Attr(uint32(c.TimeoutTCPFin.Se...
go
func (i *Handle) doSetConfigCmd(c *Config) error { req := newIPVSRequest(ipvsCmdSetConfig) req.Seq = atomic.AddUint32(&i.seq, 1) req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCP, nl.Uint32Attr(uint32(c.TimeoutTCP.Seconds())))) req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCPFin, nl.Uint32Attr(uint32(c.TimeoutTCPFin.Se...
[ "func", "(", "i", "*", "Handle", ")", "doSetConfigCmd", "(", "c", "*", "Config", ")", "error", "{", "req", ":=", "newIPVSRequest", "(", "ipvsCmdSetConfig", ")", "\n", "req", ".", "Seq", "=", "atomic", ".", "AddUint32", "(", "&", "i", ".", "seq", ",",...
// doSetConfigCmd a wrapper function to be used by SetConfig
[ "doSetConfigCmd", "a", "wrapper", "function", "to", "be", "used", "by", "SetConfig" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L548-L559
train
docker/libnetwork
drivers/bridge/setup_device.go
setupDeviceUp
func setupDeviceUp(config *networkConfiguration, i *bridgeInterface) error { err := i.nlh.LinkSetUp(i.Link) if err != nil { return fmt.Errorf("Failed to set link up for %s: %v", config.BridgeName, err) } // Attempt to update the bridge interface to refresh the flags status, // ignoring any failure to do so. if...
go
func setupDeviceUp(config *networkConfiguration, i *bridgeInterface) error { err := i.nlh.LinkSetUp(i.Link) if err != nil { return fmt.Errorf("Failed to set link up for %s: %v", config.BridgeName, err) } // Attempt to update the bridge interface to refresh the flags status, // ignoring any failure to do so. if...
[ "func", "setupDeviceUp", "(", "config", "*", "networkConfiguration", ",", "i", "*", "bridgeInterface", ")", "error", "{", "err", ":=", "i", ".", "nlh", ".", "LinkSetUp", "(", "i", ".", "Link", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ...
// SetupDeviceUp ups the given bridge interface.
[ "SetupDeviceUp", "ups", "the", "given", "bridge", "interface", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_device.go#L54-L68
train
docker/libnetwork
portallocator/portallocator.go
Error
func (e ErrPortAlreadyAllocated) Error() string { return fmt.Sprintf("Bind for %s:%d failed: port is already allocated", e.ip, e.port) }
go
func (e ErrPortAlreadyAllocated) Error() string { return fmt.Sprintf("Bind for %s:%d failed: port is already allocated", e.ip, e.port) }
[ "func", "(", "e", "ErrPortAlreadyAllocated", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "ip", ",", "e", ".", "port", ")", "\n", "}" ]
// Error is the implementation of error.Error interface
[ "Error", "is", "the", "implementation", "of", "error", ".", "Error", "interface" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L59-L61
train
docker/libnetwork
portallocator/portallocator.go
RequestPort
func (p *PortAllocator) RequestPort(ip net.IP, proto string, port int) (int, error) { return p.RequestPortInRange(ip, proto, port, port) }
go
func (p *PortAllocator) RequestPort(ip net.IP, proto string, port int) (int, error) { return p.RequestPortInRange(ip, proto, port, port) }
[ "func", "(", "p", "*", "PortAllocator", ")", "RequestPort", "(", "ip", "net", ".", "IP", ",", "proto", "string", ",", "port", "int", ")", "(", "int", ",", "error", ")", "{", "return", "p", ".", "RequestPortInRange", "(", "ip", ",", "proto", ",", "p...
// RequestPort requests new port from global ports pool for specified ip and proto. // If port is 0 it returns first free port. Otherwise it checks port availability // in proto's pool and returns that port or error if port is already busy.
[ "RequestPort", "requests", "new", "port", "from", "global", "ports", "pool", "for", "specified", "ip", "and", "proto", ".", "If", "port", "is", "0", "it", "returns", "first", "free", "port", ".", "Otherwise", "it", "checks", "port", "availability", "in", "...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L110-L112
train
docker/libnetwork
portallocator/portallocator.go
ReleasePort
func (p *PortAllocator) ReleasePort(ip net.IP, proto string, port int) error { p.mutex.Lock() defer p.mutex.Unlock() if ip == nil { ip = defaultIP } protomap, ok := p.ipMap[ip.String()] if !ok { return nil } delete(protomap[proto].p, port) return nil }
go
func (p *PortAllocator) ReleasePort(ip net.IP, proto string, port int) error { p.mutex.Lock() defer p.mutex.Unlock() if ip == nil { ip = defaultIP } protomap, ok := p.ipMap[ip.String()] if !ok { return nil } delete(protomap[proto].p, port) return nil }
[ "func", "(", "p", "*", "PortAllocator", ")", "ReleasePort", "(", "ip", "net", ".", "IP", ",", "proto", "string", ",", "port", "int", ")", "error", "{", "p", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mutex", ".", "Unlock", "("...
// ReleasePort releases port from global ports pool for specified ip and proto.
[ "ReleasePort", "releases", "port", "from", "global", "ports", "pool", "for", "specified", "ip", "and", "proto", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L158-L171
train
docker/libnetwork
portallocator/portallocator.go
ReleaseAll
func (p *PortAllocator) ReleaseAll() error { p.mutex.Lock() p.ipMap = ipMapping{} p.mutex.Unlock() return nil }
go
func (p *PortAllocator) ReleaseAll() error { p.mutex.Lock() p.ipMap = ipMapping{} p.mutex.Unlock() return nil }
[ "func", "(", "p", "*", "PortAllocator", ")", "ReleaseAll", "(", ")", "error", "{", "p", ".", "mutex", ".", "Lock", "(", ")", "\n", "p", ".", "ipMap", "=", "ipMapping", "{", "}", "\n", "p", ".", "mutex", ".", "Unlock", "(", ")", "\n", "return", ...
// ReleaseAll releases all ports for all ips.
[ "ReleaseAll", "releases", "all", "ports", "for", "all", "ips", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L186-L191
train
docker/libnetwork
drivers/macvlan/macvlan_setup.go
createMacVlan
func createMacVlan(containerIfName, parent, macvlanMode string) (string, error) { // Set the macvlan mode. Default is bridge mode mode, err := setMacVlanMode(macvlanMode) if err != nil { return "", fmt.Errorf("Unsupported %s macvlan mode: %v", macvlanMode, err) } // verify the Docker host interface acting as the...
go
func createMacVlan(containerIfName, parent, macvlanMode string) (string, error) { // Set the macvlan mode. Default is bridge mode mode, err := setMacVlanMode(macvlanMode) if err != nil { return "", fmt.Errorf("Unsupported %s macvlan mode: %v", macvlanMode, err) } // verify the Docker host interface acting as the...
[ "func", "createMacVlan", "(", "containerIfName", ",", "parent", ",", "macvlanMode", "string", ")", "(", "string", ",", "error", ")", "{", "// Set the macvlan mode. Default is bridge mode", "mode", ",", "err", ":=", "setMacVlanMode", "(", "macvlanMode", ")", "\n", ...
// Create the macvlan slave specifying the source name
[ "Create", "the", "macvlan", "slave", "specifying", "the", "source", "name" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_setup.go#L20-L49
train
docker/libnetwork
drivers/macvlan/macvlan_setup.go
setMacVlanMode
func setMacVlanMode(mode string) (netlink.MacvlanMode, error) { switch mode { case modePrivate: return netlink.MACVLAN_MODE_PRIVATE, nil case modeVepa: return netlink.MACVLAN_MODE_VEPA, nil case modeBridge: return netlink.MACVLAN_MODE_BRIDGE, nil case modePassthru: return netlink.MACVLAN_MODE_PASSTHRU, nil...
go
func setMacVlanMode(mode string) (netlink.MacvlanMode, error) { switch mode { case modePrivate: return netlink.MACVLAN_MODE_PRIVATE, nil case modeVepa: return netlink.MACVLAN_MODE_VEPA, nil case modeBridge: return netlink.MACVLAN_MODE_BRIDGE, nil case modePassthru: return netlink.MACVLAN_MODE_PASSTHRU, nil...
[ "func", "setMacVlanMode", "(", "mode", "string", ")", "(", "netlink", ".", "MacvlanMode", ",", "error", ")", "{", "switch", "mode", "{", "case", "modePrivate", ":", "return", "netlink", ".", "MACVLAN_MODE_PRIVATE", ",", "nil", "\n", "case", "modeVepa", ":", ...
// setMacVlanMode setter for one of the four macvlan port types
[ "setMacVlanMode", "setter", "for", "one", "of", "the", "four", "macvlan", "port", "types" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_setup.go#L52-L65
train
docker/libnetwork
drivers/macvlan/macvlan_setup.go
delVlanLink
func delVlanLink(linkName string) error { if strings.Contains(linkName, ".") { _, _, err := parseVlan(linkName) if err != nil { return err } // delete the vlan subinterface vlanLink, err := ns.NlHandle().LinkByName(linkName) if err != nil { return fmt.Errorf("failed to find interface %s on the Docker...
go
func delVlanLink(linkName string) error { if strings.Contains(linkName, ".") { _, _, err := parseVlan(linkName) if err != nil { return err } // delete the vlan subinterface vlanLink, err := ns.NlHandle().LinkByName(linkName) if err != nil { return fmt.Errorf("failed to find interface %s on the Docker...
[ "func", "delVlanLink", "(", "linkName", "string", ")", "error", "{", "if", "strings", ".", "Contains", "(", "linkName", ",", "\"", "\"", ")", "{", "_", ",", "_", ",", "err", ":=", "parseVlan", "(", "linkName", ")", "\n", "if", "err", "!=", "nil", "...
// delVlanLink verifies only sub-interfaces with a vlan id get deleted
[ "delVlanLink", "verifies", "only", "sub", "-", "interfaces", "with", "a", "vlan", "id", "get", "deleted" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_setup.go#L116-L140
train
docker/libnetwork
resolvconf/resolvconf.go
GetSpecific
func GetSpecific(path string) (*File, error) { resolv, err := ioutil.ReadFile(path) if err != nil { return nil, err } hash, err := ioutils.HashData(bytes.NewReader(resolv)) if err != nil { return nil, err } return &File{Content: resolv, Hash: hash}, nil }
go
func GetSpecific(path string) (*File, error) { resolv, err := ioutil.ReadFile(path) if err != nil { return nil, err } hash, err := ioutils.HashData(bytes.NewReader(resolv)) if err != nil { return nil, err } return &File{Content: resolv, Hash: hash}, nil }
[ "func", "GetSpecific", "(", "path", "string", ")", "(", "*", "File", ",", "error", ")", "{", "resolv", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n...
// GetSpecific returns the contents of the user specified resolv.conf file and its hash
[ "GetSpecific", "returns", "the", "contents", "of", "the", "user", "specified", "resolv", ".", "conf", "file", "and", "its", "hash" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L62-L72
train
docker/libnetwork
resolvconf/resolvconf.go
GetLastModified
func GetLastModified() *File { lastModified.Lock() defer lastModified.Unlock() return &File{Content: lastModified.contents, Hash: lastModified.sha256} }
go
func GetLastModified() *File { lastModified.Lock() defer lastModified.Unlock() return &File{Content: lastModified.contents, Hash: lastModified.sha256} }
[ "func", "GetLastModified", "(", ")", "*", "File", "{", "lastModified", ".", "Lock", "(", ")", "\n", "defer", "lastModified", ".", "Unlock", "(", ")", "\n\n", "return", "&", "File", "{", "Content", ":", "lastModified", ".", "contents", ",", "Hash", ":", ...
// GetLastModified retrieves the last used contents and hash of the host resolv.conf. // Used by containers updating on restart
[ "GetLastModified", "retrieves", "the", "last", "used", "contents", "and", "hash", "of", "the", "host", "resolv", ".", "conf", ".", "Used", "by", "containers", "updating", "on", "restart" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L100-L105
train
docker/libnetwork
resolvconf/resolvconf.go
getLines
func getLines(input []byte, commentMarker []byte) [][]byte { lines := bytes.Split(input, []byte("\n")) var output [][]byte for _, currentLine := range lines { var commentIndex = bytes.Index(currentLine, commentMarker) if commentIndex == -1 { output = append(output, currentLine) } else { output = append(o...
go
func getLines(input []byte, commentMarker []byte) [][]byte { lines := bytes.Split(input, []byte("\n")) var output [][]byte for _, currentLine := range lines { var commentIndex = bytes.Index(currentLine, commentMarker) if commentIndex == -1 { output = append(output, currentLine) } else { output = append(o...
[ "func", "getLines", "(", "input", "[", "]", "byte", ",", "commentMarker", "[", "]", "byte", ")", "[", "]", "[", "]", "byte", "{", "lines", ":=", "bytes", ".", "Split", "(", "input", ",", "[", "]", "byte", "(", "\"", "\\n", "\"", ")", ")", "\n",...
// getLines parses input into lines and strips away comments.
[ "getLines", "parses", "input", "into", "lines", "and", "strips", "away", "comments", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L139-L151
train
docker/libnetwork
resolvconf/resolvconf.go
Build
func Build(path string, dns, dnsSearch, dnsOptions []string) (*File, error) { content := bytes.NewBuffer(nil) if len(dnsSearch) > 0 { if searchString := strings.Join(dnsSearch, " "); strings.Trim(searchString, " ") != "." { if _, err := content.WriteString("search " + searchString + "\n"); err != nil { retur...
go
func Build(path string, dns, dnsSearch, dnsOptions []string) (*File, error) { content := bytes.NewBuffer(nil) if len(dnsSearch) > 0 { if searchString := strings.Join(dnsSearch, " "); strings.Trim(searchString, " ") != "." { if _, err := content.WriteString("search " + searchString + "\n"); err != nil { retur...
[ "func", "Build", "(", "path", "string", ",", "dns", ",", "dnsSearch", ",", "dnsOptions", "[", "]", "string", ")", "(", "*", "File", ",", "error", ")", "{", "content", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n", "if", "len", "(", "dnsSea...
// Build writes a configuration file to path containing a "nameserver" entry // for every element in dns, a "search" entry for every element in // dnsSearch, and an "options" entry for every element in dnsOptions.
[ "Build", "writes", "a", "configuration", "file", "to", "path", "containing", "a", "nameserver", "entry", "for", "every", "element", "in", "dns", "a", "search", "entry", "for", "every", "element", "in", "dnsSearch", "and", "an", "options", "entry", "for", "ev...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L223-L251
train
docker/libnetwork
ipam/allocator.go
NewAllocator
func NewAllocator(lcDs, glDs datastore.DataStore) (*Allocator, error) { a := &Allocator{} // Load predefined subnet pools a.predefined = map[string][]*net.IPNet{ localAddressSpace: ipamutils.GetLocalScopeDefaultNetworks(), globalAddressSpace: ipamutils.GetGlobalScopeDefaultNetworks(), } // Initialize asInd...
go
func NewAllocator(lcDs, glDs datastore.DataStore) (*Allocator, error) { a := &Allocator{} // Load predefined subnet pools a.predefined = map[string][]*net.IPNet{ localAddressSpace: ipamutils.GetLocalScopeDefaultNetworks(), globalAddressSpace: ipamutils.GetGlobalScopeDefaultNetworks(), } // Initialize asInd...
[ "func", "NewAllocator", "(", "lcDs", ",", "glDs", "datastore", ".", "DataStore", ")", "(", "*", "Allocator", ",", "error", ")", "{", "a", ":=", "&", "Allocator", "{", "}", "\n\n", "// Load predefined subnet pools", "a", ".", "predefined", "=", "map", "[", ...
// NewAllocator returns an instance of libnetwork ipam
[ "NewAllocator", "returns", "an", "instance", "of", "libnetwork", "ipam" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L44-L73
train
docker/libnetwork
ipam/allocator.go
checkConsistency
func (a *Allocator) checkConsistency(as string) { var sKeyList []SubnetKey // Retrieve this address space's configuration and bitmasks from the datastore a.refresh(as) a.Lock() aSpace, ok := a.addrSpaces[as] a.Unlock() if !ok { return } a.updateBitMasks(aSpace) aSpace.Lock() for sk, pd := range aSpace.su...
go
func (a *Allocator) checkConsistency(as string) { var sKeyList []SubnetKey // Retrieve this address space's configuration and bitmasks from the datastore a.refresh(as) a.Lock() aSpace, ok := a.addrSpaces[as] a.Unlock() if !ok { return } a.updateBitMasks(aSpace) aSpace.Lock() for sk, pd := range aSpace.su...
[ "func", "(", "a", "*", "Allocator", ")", "checkConsistency", "(", "as", "string", ")", "{", "var", "sKeyList", "[", "]", "SubnetKey", "\n\n", "// Retrieve this address space's configuration and bitmasks from the datastore", "a", ".", "refresh", "(", "as", ")", "\n",...
// Checks for and fixes damaged bitmask.
[ "Checks", "for", "and", "fixes", "damaged", "bitmask", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L118-L148
train
docker/libnetwork
ipam/allocator.go
DiscoverNew
func (a *Allocator) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error { if dType != discoverapi.DatastoreConfig { return nil } dsc, ok := data.(discoverapi.DatastoreConfigData) if !ok { return types.InternalErrorf("incorrect data in datastore update notification: %v", data) } ds, err := d...
go
func (a *Allocator) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error { if dType != discoverapi.DatastoreConfig { return nil } dsc, ok := data.(discoverapi.DatastoreConfigData) if !ok { return types.InternalErrorf("incorrect data in datastore update notification: %v", data) } ds, err := d...
[ "func", "(", "a", "*", "Allocator", ")", "DiscoverNew", "(", "dType", "discoverapi", ".", "DiscoveryType", ",", "data", "interface", "{", "}", ")", "error", "{", "if", "dType", "!=", "discoverapi", ".", "DatastoreConfig", "{", "return", "nil", "\n", "}", ...
// DiscoverNew informs the allocator about a new global scope datastore
[ "DiscoverNew", "informs", "the", "allocator", "about", "a", "new", "global", "scope", "datastore" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L178-L194
train
docker/libnetwork
ipam/allocator.go
RequestPool
func (a *Allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) { logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6) k, nw, ipr, err := a.parsePoolRequest(addressSpace, pool, subPool, v6) i...
go
func (a *Allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) { logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6) k, nw, ipr, err := a.parsePoolRequest(addressSpace, pool, subPool, v6) i...
[ "func", "(", "a", "*", "Allocator", ")", "RequestPool", "(", "addressSpace", ",", "pool", ",", "subPool", "string", ",", "options", "map", "[", "string", "]", "string", ",", "v6", "bool", ")", "(", "string", ",", "*", "net", ".", "IPNet", ",", "map",...
// RequestPool returns an address pool along with its unique id. // addressSpace must be a valid address space name and must not be the empty string. // If pool is the empty string then the default predefined pool for addressSpace will be used, otherwise pool must be a valid IP address and length in CIDR notation. // I...
[ "RequestPool", "returns", "an", "address", "pool", "along", "with", "its", "unique", "id", ".", "addressSpace", "must", "be", "a", "valid", "address", "space", "name", "and", "must", "not", "be", "the", "empty", "string", ".", "If", "pool", "is", "the", ...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L211-L256
train
docker/libnetwork
ipam/allocator.go
ReleasePool
func (a *Allocator) ReleasePool(poolID string) error { logrus.Debugf("ReleasePool(%s)", poolID) k := SubnetKey{} if err := k.FromString(poolID); err != nil { return types.BadRequestErrorf("invalid pool id: %s", poolID) } retry: if err := a.refresh(k.AddressSpace); err != nil { return err } aSpace, err := a...
go
func (a *Allocator) ReleasePool(poolID string) error { logrus.Debugf("ReleasePool(%s)", poolID) k := SubnetKey{} if err := k.FromString(poolID); err != nil { return types.BadRequestErrorf("invalid pool id: %s", poolID) } retry: if err := a.refresh(k.AddressSpace); err != nil { return err } aSpace, err := a...
[ "func", "(", "a", "*", "Allocator", ")", "ReleasePool", "(", "poolID", "string", ")", "error", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "poolID", ")", "\n", "k", ":=", "SubnetKey", "{", "}", "\n", "if", "err", ":=", "k", ".", "FromString...
// ReleasePool releases the address pool identified by the passed id
[ "ReleasePool", "releases", "the", "address", "pool", "identified", "by", "the", "passed", "id" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L259-L289
train
docker/libnetwork
ipam/allocator.go
getAddrSpace
func (a *Allocator) getAddrSpace(as string) (*addrSpace, error) { a.Lock() defer a.Unlock() aSpace, ok := a.addrSpaces[as] if !ok { return nil, types.BadRequestErrorf("cannot find address space %s (most likely the backing datastore is not configured)", as) } return aSpace, nil }
go
func (a *Allocator) getAddrSpace(as string) (*addrSpace, error) { a.Lock() defer a.Unlock() aSpace, ok := a.addrSpaces[as] if !ok { return nil, types.BadRequestErrorf("cannot find address space %s (most likely the backing datastore is not configured)", as) } return aSpace, nil }
[ "func", "(", "a", "*", "Allocator", ")", "getAddrSpace", "(", "as", "string", ")", "(", "*", "addrSpace", ",", "error", ")", "{", "a", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "Unlock", "(", ")", "\n", "aSpace", ",", "ok", ":=", "a", "."...
// Given the address space, returns the local or global PoolConfig based on whether the // address space is local or global. AddressSpace locality is registered with IPAM out of band.
[ "Given", "the", "address", "space", "returns", "the", "local", "or", "global", "PoolConfig", "based", "on", "whether", "the", "address", "space", "is", "local", "or", "global", ".", "AddressSpace", "locality", "is", "registered", "with", "IPAM", "out", "of", ...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L293-L301
train
docker/libnetwork
ipam/allocator.go
parsePoolRequest
func (a *Allocator) parsePoolRequest(addressSpace, pool, subPool string, v6 bool) (*SubnetKey, *net.IPNet, *AddressRange, error) { var ( nw *net.IPNet ipr *AddressRange err error ) if addressSpace == "" { return nil, nil, nil, ipamapi.ErrInvalidAddressSpace } if pool == "" && subPool != "" { return ni...
go
func (a *Allocator) parsePoolRequest(addressSpace, pool, subPool string, v6 bool) (*SubnetKey, *net.IPNet, *AddressRange, error) { var ( nw *net.IPNet ipr *AddressRange err error ) if addressSpace == "" { return nil, nil, nil, ipamapi.ErrInvalidAddressSpace } if pool == "" && subPool != "" { return ni...
[ "func", "(", "a", "*", "Allocator", ")", "parsePoolRequest", "(", "addressSpace", ",", "pool", ",", "subPool", "string", ",", "v6", "bool", ")", "(", "*", "SubnetKey", ",", "*", "net", ".", "IPNet", ",", "*", "AddressRange", ",", "error", ")", "{", "...
// parsePoolRequest parses and validates a request to create a new pool under addressSpace and returns // a SubnetKey, network and range describing the request.
[ "parsePoolRequest", "parses", "and", "validates", "a", "request", "to", "create", "a", "new", "pool", "under", "addressSpace", "and", "returns", "a", "SubnetKey", "network", "and", "range", "describing", "the", "request", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L305-L335
train
docker/libnetwork
ipam/allocator.go
RequestAddress
func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) { logrus.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts) k := SubnetKey{} if err := k.FromString(poolID); err != nil { return nil, nil, types.BadRequestErrorf("invali...
go
func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) { logrus.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts) k := SubnetKey{} if err := k.FromString(poolID); err != nil { return nil, nil, types.BadRequestErrorf("invali...
[ "func", "(", "a", "*", "Allocator", ")", "RequestAddress", "(", "poolID", "string", ",", "prefAddress", "net", ".", "IP", ",", "opts", "map", "[", "string", "]", "string", ")", "(", "*", "net", ".", "IPNet", ",", "map", "[", "string", "]", "string", ...
// RequestAddress returns an address from the specified pool ID
[ "RequestAddress", "returns", "an", "address", "from", "the", "specified", "pool", "ID" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L451-L505
train
docker/libnetwork
ipam/allocator.go
ReleaseAddress
func (a *Allocator) ReleaseAddress(poolID string, address net.IP) error { logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address) k := SubnetKey{} if err := k.FromString(poolID); err != nil { return types.BadRequestErrorf("invalid pool id: %s", poolID) } if err := a.refresh(k.AddressSpace); err != nil { retu...
go
func (a *Allocator) ReleaseAddress(poolID string, address net.IP) error { logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address) k := SubnetKey{} if err := k.FromString(poolID); err != nil { return types.BadRequestErrorf("invalid pool id: %s", poolID) } if err := a.refresh(k.AddressSpace); err != nil { retu...
[ "func", "(", "a", "*", "Allocator", ")", "ReleaseAddress", "(", "poolID", "string", ",", "address", "net", ".", "IP", ")", "error", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "poolID", ",", "address", ")", "\n", "k", ":=", "SubnetKey", "{", ...
// ReleaseAddress releases the address from the specified pool ID
[ "ReleaseAddress", "releases", "the", "address", "from", "the", "specified", "pool", "ID" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L508-L563
train
docker/libnetwork
ipam/allocator.go
DumpDatabase
func (a *Allocator) DumpDatabase() string { a.Lock() aspaces := make(map[string]*addrSpace, len(a.addrSpaces)) orderedAS := make([]string, 0, len(a.addrSpaces)) for as, aSpace := range a.addrSpaces { orderedAS = append(orderedAS, as) aspaces[as] = aSpace } a.Unlock() sort.Strings(orderedAS) var s string ...
go
func (a *Allocator) DumpDatabase() string { a.Lock() aspaces := make(map[string]*addrSpace, len(a.addrSpaces)) orderedAS := make([]string, 0, len(a.addrSpaces)) for as, aSpace := range a.addrSpaces { orderedAS = append(orderedAS, as) aspaces[as] = aSpace } a.Unlock() sort.Strings(orderedAS) var s string ...
[ "func", "(", "a", "*", "Allocator", ")", "DumpDatabase", "(", ")", "string", "{", "a", ".", "Lock", "(", ")", "\n", "aspaces", ":=", "make", "(", "map", "[", "string", "]", "*", "addrSpace", ",", "len", "(", "a", ".", "addrSpaces", ")", ")", "\n"...
// DumpDatabase dumps the internal info
[ "DumpDatabase", "dumps", "the", "internal", "info" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L605-L637
train
docker/libnetwork
service_linux.go
populateLoadBalancers
func (sb *sandbox) populateLoadBalancers(ep *endpoint) { // This is an interface less endpoint. Nothing to do. if ep.Iface() == nil { return } n := ep.getNetwork() eIP := ep.Iface().Address() if n.ingress { if err := addRedirectRules(sb.Key(), eIP, ep.ingressPorts); err != nil { logrus.Errorf("Failed to ...
go
func (sb *sandbox) populateLoadBalancers(ep *endpoint) { // This is an interface less endpoint. Nothing to do. if ep.Iface() == nil { return } n := ep.getNetwork() eIP := ep.Iface().Address() if n.ingress { if err := addRedirectRules(sb.Key(), eIP, ep.ingressPorts); err != nil { logrus.Errorf("Failed to ...
[ "func", "(", "sb", "*", "sandbox", ")", "populateLoadBalancers", "(", "ep", "*", "endpoint", ")", "{", "// This is an interface less endpoint. Nothing to do.", "if", "ep", ".", "Iface", "(", ")", "==", "nil", "{", "return", "\n", "}", "\n\n", "n", ":=", "ep"...
// Populate all loadbalancers on the network that the passed endpoint // belongs to, into this sandbox.
[ "Populate", "all", "loadbalancers", "on", "the", "network", "that", "the", "passed", "endpoint", "belongs", "to", "into", "this", "sandbox", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service_linux.go#L35-L49
train
docker/libnetwork
service_linux.go
invokeFWMarker
func invokeFWMarker(path string, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, isDelete bool, lbMode string) error { var ingressPortsFile string if len(ingressPorts) != 0 { var err error ingressPortsFile, err = writePortsToFile(ingressPorts) if err != nil { return err } defer o...
go
func invokeFWMarker(path string, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, isDelete bool, lbMode string) error { var ingressPortsFile string if len(ingressPorts) != 0 { var err error ingressPortsFile, err = writePortsToFile(ingressPorts) if err != nil { return err } defer o...
[ "func", "invokeFWMarker", "(", "path", "string", ",", "vip", "net", ".", "IP", ",", "fwMark", "uint32", ",", "ingressPorts", "[", "]", "*", "PortConfig", ",", "eIP", "*", "net", ".", "IPNet", ",", "isDelete", "bool", ",", "lbMode", "string", ")", "erro...
// Invoke fwmarker reexec routine to mark vip destined packets with // the passed firewall mark.
[ "Invoke", "fwmarker", "reexec", "routine", "to", "mark", "vip", "destined", "packets", "with", "the", "passed", "firewall", "mark", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service_linux.go#L575-L605
train
docker/libnetwork
drivers/windows/windows.go
IsBuiltinLocalDriver
func IsBuiltinLocalDriver(networkType string) bool { if "l2bridge" == networkType || "l2tunnel" == networkType || "nat" == networkType || "ics" == networkType || "transparent" == networkType { return true } return false }
go
func IsBuiltinLocalDriver(networkType string) bool { if "l2bridge" == networkType || "l2tunnel" == networkType || "nat" == networkType || "ics" == networkType || "transparent" == networkType { return true } return false }
[ "func", "IsBuiltinLocalDriver", "(", "networkType", "string", ")", "bool", "{", "if", "\"", "\"", "==", "networkType", "||", "\"", "\"", "==", "networkType", "||", "\"", "\"", "==", "networkType", "||", "\"", "\"", "==", "networkType", "||", "\"", "\"", ...
// IsBuiltinLocalDriver validates if network-type is a builtin local-scoped driver
[ "IsBuiltinLocalDriver", "validates", "if", "network", "-", "type", "is", "a", "builtin", "local", "-", "scoped", "driver" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L113-L119
train
docker/libnetwork
drivers/windows/windows.go
newDriver
func newDriver(networkType string) *driver { return &driver{name: networkType, networks: map[string]*hnsNetwork{}} }
go
func newDriver(networkType string) *driver { return &driver{name: networkType, networks: map[string]*hnsNetwork{}} }
[ "func", "newDriver", "(", "networkType", "string", ")", "*", "driver", "{", "return", "&", "driver", "{", "name", ":", "networkType", ",", "networks", ":", "map", "[", "string", "]", "*", "hnsNetwork", "{", "}", "}", "\n", "}" ]
// New constructs a new bridge driver
[ "New", "constructs", "a", "new", "bridge", "driver" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L122-L124
train
docker/libnetwork
drivers/windows/windows.go
GetInit
func GetInit(networkType string) func(dc driverapi.DriverCallback, config map[string]interface{}) error { return func(dc driverapi.DriverCallback, config map[string]interface{}) error { if !IsBuiltinLocalDriver(networkType) { return types.BadRequestErrorf("Network type not supported: %s", networkType) } d :=...
go
func GetInit(networkType string) func(dc driverapi.DriverCallback, config map[string]interface{}) error { return func(dc driverapi.DriverCallback, config map[string]interface{}) error { if !IsBuiltinLocalDriver(networkType) { return types.BadRequestErrorf("Network type not supported: %s", networkType) } d :=...
[ "func", "GetInit", "(", "networkType", "string", ")", "func", "(", "dc", "driverapi", ".", "DriverCallback", ",", "config", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "return", "func", "(", "dc", "driverapi", ".", "DriverCallback"...
// GetInit returns an initializer for the given network type
[ "GetInit", "returns", "an", "initializer", "for", "the", "given", "network", "type" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L127-L145
train
docker/libnetwork
drivers/windows/windows.go
ConvertPortBindings
func ConvertPortBindings(portBindings []types.PortBinding) ([]json.RawMessage, error) { var pbs []json.RawMessage // Enumerate through the port bindings specified by the user and convert // them into the internal structure matching the JSON blob that can be // understood by the HCS. for _, elem := range portBindi...
go
func ConvertPortBindings(portBindings []types.PortBinding) ([]json.RawMessage, error) { var pbs []json.RawMessage // Enumerate through the port bindings specified by the user and convert // them into the internal structure matching the JSON blob that can be // understood by the HCS. for _, elem := range portBindi...
[ "func", "ConvertPortBindings", "(", "portBindings", "[", "]", "types", ".", "PortBinding", ")", "(", "[", "]", "json", ".", "RawMessage", ",", "error", ")", "{", "var", "pbs", "[", "]", "json", ".", "RawMessage", "\n\n", "// Enumerate through the port bindings...
// ConvertPortBindings converts PortBindings to JSON for HNS request
[ "ConvertPortBindings", "converts", "PortBindings", "to", "JSON", "for", "HNS", "request" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L449-L482
train
docker/libnetwork
drivers/windows/windows.go
ParsePortBindingPolicies
func ParsePortBindingPolicies(policies []json.RawMessage) ([]types.PortBinding, error) { var bindings []types.PortBinding hcsPolicy := &hcsshim.NatPolicy{} for _, elem := range policies { if err := json.Unmarshal([]byte(elem), &hcsPolicy); err != nil || hcsPolicy.Type != "NAT" { continue } binding := typ...
go
func ParsePortBindingPolicies(policies []json.RawMessage) ([]types.PortBinding, error) { var bindings []types.PortBinding hcsPolicy := &hcsshim.NatPolicy{} for _, elem := range policies { if err := json.Unmarshal([]byte(elem), &hcsPolicy); err != nil || hcsPolicy.Type != "NAT" { continue } binding := typ...
[ "func", "ParsePortBindingPolicies", "(", "policies", "[", "]", "json", ".", "RawMessage", ")", "(", "[", "]", "types", ".", "PortBinding", ",", "error", ")", "{", "var", "bindings", "[", "]", "types", ".", "PortBinding", "\n", "hcsPolicy", ":=", "&", "hc...
// ParsePortBindingPolicies parses HNS endpoint response message to PortBindings
[ "ParsePortBindingPolicies", "parses", "HNS", "endpoint", "response", "message", "to", "PortBindings" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L485-L507
train
docker/libnetwork
drivers/windows/windows.go
ParseEndpointConnectivity
func ParseEndpointConnectivity(epOptions map[string]interface{}) (*EndpointConnectivity, error) { if epOptions == nil { return nil, nil } ec := &EndpointConnectivity{} if opt, ok := epOptions[netlabel.PortMap]; ok { if bs, ok := opt.([]types.PortBinding); ok { ec.PortBindings = bs } else { return nil,...
go
func ParseEndpointConnectivity(epOptions map[string]interface{}) (*EndpointConnectivity, error) { if epOptions == nil { return nil, nil } ec := &EndpointConnectivity{} if opt, ok := epOptions[netlabel.PortMap]; ok { if bs, ok := opt.([]types.PortBinding); ok { ec.PortBindings = bs } else { return nil,...
[ "func", "ParseEndpointConnectivity", "(", "epOptions", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "*", "EndpointConnectivity", ",", "error", ")", "{", "if", "epOptions", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n\n", "...
// ParseEndpointConnectivity parses options passed to CreateEndpoint, specifically port bindings, and store in a endpointConnectivity object.
[ "ParseEndpointConnectivity", "parses", "options", "passed", "to", "CreateEndpoint", "specifically", "port", "bindings", "and", "store", "in", "a", "endpointConnectivity", "object", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L560-L583
train
docker/libnetwork
service_common.go
cleanupServiceDiscovery
func (c *controller) cleanupServiceDiscovery(cleanupNID string) { c.Lock() defer c.Unlock() if cleanupNID == "" { logrus.Debugf("cleanupServiceDiscovery for all networks") c.svcRecords = make(map[string]svcInfo) return } logrus.Debugf("cleanupServiceDiscovery for network:%s", cleanupNID) delete(c.svcRecords...
go
func (c *controller) cleanupServiceDiscovery(cleanupNID string) { c.Lock() defer c.Unlock() if cleanupNID == "" { logrus.Debugf("cleanupServiceDiscovery for all networks") c.svcRecords = make(map[string]svcInfo) return } logrus.Debugf("cleanupServiceDiscovery for network:%s", cleanupNID) delete(c.svcRecords...
[ "func", "(", "c", "*", "controller", ")", "cleanupServiceDiscovery", "(", "cleanupNID", "string", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "if", "cleanupNID", "==", "\"", "\"", "{", "logrus", ".", "Debu...
// cleanupServiceDiscovery when the network is being deleted, erase all the associated service discovery records
[ "cleanupServiceDiscovery", "when", "the", "network", "is", "being", "deleted", "erase", "all", "the", "associated", "service", "discovery", "records" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service_common.go#L167-L177
train
docker/libnetwork
drivers/bridge/setup_bridgenetfiltering.go
getKernelBoolParam
func getKernelBoolParam(path string) (bool, error) { enabled := false line, err := ioutil.ReadFile(path) if err != nil { return false, err } if len(line) > 0 { enabled = line[0] == '1' } return enabled, err }
go
func getKernelBoolParam(path string) (bool, error) { enabled := false line, err := ioutil.ReadFile(path) if err != nil { return false, err } if len(line) > 0 { enabled = line[0] == '1' } return enabled, err }
[ "func", "getKernelBoolParam", "(", "path", "string", ")", "(", "bool", ",", "error", ")", "{", "enabled", ":=", "false", "\n", "line", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fals...
//Gets the value of the kernel parameters located at the given path
[ "Gets", "the", "value", "of", "the", "kernel", "parameters", "located", "at", "the", "given", "path" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_bridgenetfiltering.go#L123-L133
train
docker/libnetwork
drivers/bridge/setup_bridgenetfiltering.go
setKernelBoolParam
func setKernelBoolParam(path string, on bool) error { value := byte('0') if on { value = byte('1') } return ioutil.WriteFile(path, []byte{value, '\n'}, 0644) }
go
func setKernelBoolParam(path string, on bool) error { value := byte('0') if on { value = byte('1') } return ioutil.WriteFile(path, []byte{value, '\n'}, 0644) }
[ "func", "setKernelBoolParam", "(", "path", "string", ",", "on", "bool", ")", "error", "{", "value", ":=", "byte", "(", "'0'", ")", "\n", "if", "on", "{", "value", "=", "byte", "(", "'1'", ")", "\n", "}", "\n", "return", "ioutil", ".", "WriteFile", ...
//Sets the value of the kernel parameter located at the given path
[ "Sets", "the", "value", "of", "the", "kernel", "parameter", "located", "at", "the", "given", "path" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_bridgenetfiltering.go#L136-L142
train
docker/libnetwork
drivers/bridge/setup_bridgenetfiltering.go
isPacketForwardingEnabled
func isPacketForwardingEnabled(ipVer ipVersion, iface string) (bool, error) { switch ipVer { case ipv4, ipv6: return getKernelBoolParam(getForwardingKernelParam(ipVer, iface)) case ipvboth: enabled, err := getKernelBoolParam(getForwardingKernelParam(ipv4, "")) if err != nil || !enabled { return enabled, err...
go
func isPacketForwardingEnabled(ipVer ipVersion, iface string) (bool, error) { switch ipVer { case ipv4, ipv6: return getKernelBoolParam(getForwardingKernelParam(ipVer, iface)) case ipvboth: enabled, err := getKernelBoolParam(getForwardingKernelParam(ipv4, "")) if err != nil || !enabled { return enabled, err...
[ "func", "isPacketForwardingEnabled", "(", "ipVer", "ipVersion", ",", "iface", "string", ")", "(", "bool", ",", "error", ")", "{", "switch", "ipVer", "{", "case", "ipv4", ",", "ipv6", ":", "return", "getKernelBoolParam", "(", "getForwardingKernelParam", "(", "i...
//Checks to see if packet forwarding is enabled
[ "Checks", "to", "see", "if", "packet", "forwarding", "is", "enabled" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_bridgenetfiltering.go#L145-L158
train
docker/libnetwork
endpoint.go
isServiceEnabled
func (ep *endpoint) isServiceEnabled() bool { ep.Lock() defer ep.Unlock() return ep.serviceEnabled }
go
func (ep *endpoint) isServiceEnabled() bool { ep.Lock() defer ep.Unlock() return ep.serviceEnabled }
[ "func", "(", "ep", "*", "endpoint", ")", "isServiceEnabled", "(", ")", "bool", "{", "ep", ".", "Lock", "(", ")", "\n", "defer", "ep", ".", "Unlock", "(", ")", "\n", "return", "ep", ".", "serviceEnabled", "\n", "}" ]
// isServiceEnabled check if service is enabled on the endpoint
[ "isServiceEnabled", "check", "if", "service", "is", "enabled", "on", "the", "endpoint" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L314-L318
train
docker/libnetwork
endpoint.go
enableService
func (ep *endpoint) enableService() { ep.Lock() defer ep.Unlock() ep.serviceEnabled = true }
go
func (ep *endpoint) enableService() { ep.Lock() defer ep.Unlock() ep.serviceEnabled = true }
[ "func", "(", "ep", "*", "endpoint", ")", "enableService", "(", ")", "{", "ep", ".", "Lock", "(", ")", "\n", "defer", "ep", ".", "Unlock", "(", ")", "\n", "ep", ".", "serviceEnabled", "=", "true", "\n", "}" ]
// enableService sets service enabled on the endpoint
[ "enableService", "sets", "service", "enabled", "on", "the", "endpoint" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L321-L325
train
docker/libnetwork
endpoint.go
disableService
func (ep *endpoint) disableService() { ep.Lock() defer ep.Unlock() ep.serviceEnabled = false }
go
func (ep *endpoint) disableService() { ep.Lock() defer ep.Unlock() ep.serviceEnabled = false }
[ "func", "(", "ep", "*", "endpoint", ")", "disableService", "(", ")", "{", "ep", ".", "Lock", "(", ")", "\n", "defer", "ep", ".", "Unlock", "(", ")", "\n", "ep", ".", "serviceEnabled", "=", "false", "\n", "}" ]
// disableService disables service on the endpoint
[ "disableService", "disables", "service", "on", "the", "endpoint" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L328-L332
train
docker/libnetwork
endpoint.go
EndpointOptionGeneric
func EndpointOptionGeneric(generic map[string]interface{}) EndpointOption { return func(ep *endpoint) { for k, v := range generic { ep.generic[k] = v } } }
go
func EndpointOptionGeneric(generic map[string]interface{}) EndpointOption { return func(ep *endpoint) { for k, v := range generic { ep.generic[k] = v } } }
[ "func", "EndpointOptionGeneric", "(", "generic", "map", "[", "string", "]", "interface", "{", "}", ")", "EndpointOption", "{", "return", "func", "(", "ep", "*", "endpoint", ")", "{", "for", "k", ",", "v", ":=", "range", "generic", "{", "ep", ".", "gene...
// EndpointOptionGeneric function returns an option setter for a Generic option defined // in a Dictionary of Key-Value pair
[ "EndpointOptionGeneric", "function", "returns", "an", "option", "setter", "for", "a", "Generic", "option", "defined", "in", "a", "Dictionary", "of", "Key", "-", "Value", "pair" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L928-L934
train
docker/libnetwork
endpoint.go
CreateOptionIpam
func CreateOptionIpam(ipV4, ipV6 net.IP, llIPs []net.IP, ipamOptions map[string]string) EndpointOption { return func(ep *endpoint) { ep.prefAddress = ipV4 ep.prefAddressV6 = ipV6 if len(llIPs) != 0 { for _, ip := range llIPs { nw := &net.IPNet{IP: ip, Mask: linkLocalMask} if ip.To4() == nil { nw....
go
func CreateOptionIpam(ipV4, ipV6 net.IP, llIPs []net.IP, ipamOptions map[string]string) EndpointOption { return func(ep *endpoint) { ep.prefAddress = ipV4 ep.prefAddressV6 = ipV6 if len(llIPs) != 0 { for _, ip := range llIPs { nw := &net.IPNet{IP: ip, Mask: linkLocalMask} if ip.To4() == nil { nw....
[ "func", "CreateOptionIpam", "(", "ipV4", ",", "ipV6", "net", ".", "IP", ",", "llIPs", "[", "]", "net", ".", "IP", ",", "ipamOptions", "map", "[", "string", "]", "string", ")", "EndpointOption", "{", "return", "func", "(", "ep", "*", "endpoint", ")", ...
// CreateOptionIpam function returns an option setter for the ipam configuration for this endpoint
[ "CreateOptionIpam", "function", "returns", "an", "option", "setter", "for", "the", "ipam", "configuration", "for", "this", "endpoint" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L942-L957
train
docker/libnetwork
endpoint.go
CreateOptionDNS
func CreateOptionDNS(dns []string) EndpointOption { return func(ep *endpoint) { ep.generic[netlabel.DNSServers] = dns } }
go
func CreateOptionDNS(dns []string) EndpointOption { return func(ep *endpoint) { ep.generic[netlabel.DNSServers] = dns } }
[ "func", "CreateOptionDNS", "(", "dns", "[", "]", "string", ")", "EndpointOption", "{", "return", "func", "(", "ep", "*", "endpoint", ")", "{", "ep", ".", "generic", "[", "netlabel", ".", "DNSServers", "]", "=", "dns", "\n", "}", "\n", "}" ]
// CreateOptionDNS function returns an option setter for dns entry option to // be passed to container Create method.
[ "CreateOptionDNS", "function", "returns", "an", "option", "setter", "for", "dns", "entry", "option", "to", "be", "passed", "to", "container", "Create", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L985-L989
train
docker/libnetwork
endpoint.go
CreateOptionAlias
func CreateOptionAlias(name string, alias string) EndpointOption { return func(ep *endpoint) { if ep.aliases == nil { ep.aliases = make(map[string]string) } ep.aliases[alias] = name } }
go
func CreateOptionAlias(name string, alias string) EndpointOption { return func(ep *endpoint) { if ep.aliases == nil { ep.aliases = make(map[string]string) } ep.aliases[alias] = name } }
[ "func", "CreateOptionAlias", "(", "name", "string", ",", "alias", "string", ")", "EndpointOption", "{", "return", "func", "(", "ep", "*", "endpoint", ")", "{", "if", "ep", ".", "aliases", "==", "nil", "{", "ep", ".", "aliases", "=", "make", "(", "map",...
// CreateOptionAlias function returns an option setter for setting endpoint alias
[ "CreateOptionAlias", "function", "returns", "an", "option", "setter", "for", "setting", "endpoint", "alias" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L1008-L1015
train
docker/libnetwork
endpoint.go
CreateOptionService
func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig, aliases []string) EndpointOption { return func(ep *endpoint) { ep.svcName = name ep.svcID = id ep.virtualIP = vip ep.ingressPorts = ingressPorts ep.svcAliases = aliases } }
go
func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig, aliases []string) EndpointOption { return func(ep *endpoint) { ep.svcName = name ep.svcID = id ep.virtualIP = vip ep.ingressPorts = ingressPorts ep.svcAliases = aliases } }
[ "func", "CreateOptionService", "(", "name", ",", "id", "string", ",", "vip", "net", ".", "IP", ",", "ingressPorts", "[", "]", "*", "PortConfig", ",", "aliases", "[", "]", "string", ")", "EndpointOption", "{", "return", "func", "(", "ep", "*", "endpoint",...
// CreateOptionService function returns an option setter for setting service binding configuration
[ "CreateOptionService", "function", "returns", "an", "option", "setter", "for", "setting", "service", "binding", "configuration" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L1018-L1026
train
docker/libnetwork
endpoint.go
CreateOptionMyAlias
func CreateOptionMyAlias(alias string) EndpointOption { return func(ep *endpoint) { ep.myAliases = append(ep.myAliases, alias) } }
go
func CreateOptionMyAlias(alias string) EndpointOption { return func(ep *endpoint) { ep.myAliases = append(ep.myAliases, alias) } }
[ "func", "CreateOptionMyAlias", "(", "alias", "string", ")", "EndpointOption", "{", "return", "func", "(", "ep", "*", "endpoint", ")", "{", "ep", ".", "myAliases", "=", "append", "(", "ep", ".", "myAliases", ",", "alias", ")", "\n", "}", "\n", "}" ]
// CreateOptionMyAlias function returns an option setter for setting endpoint's self alias
[ "CreateOptionMyAlias", "function", "returns", "an", "option", "setter", "for", "setting", "endpoint", "s", "self", "alias" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L1029-L1033
train
docker/libnetwork
iptables/conntrack.go
DeleteConntrackEntries
func DeleteConntrackEntries(nlh *netlink.Handle, ipv4List []net.IP, ipv6List []net.IP) (uint, uint, error) { if !IsConntrackProgrammable(nlh) { return 0, 0, ErrConntrackNotConfigurable } var totalIPv4FlowPurged uint for _, ipAddress := range ipv4List { flowPurged, err := purgeConntrackState(nlh, syscall.AF_INE...
go
func DeleteConntrackEntries(nlh *netlink.Handle, ipv4List []net.IP, ipv6List []net.IP) (uint, uint, error) { if !IsConntrackProgrammable(nlh) { return 0, 0, ErrConntrackNotConfigurable } var totalIPv4FlowPurged uint for _, ipAddress := range ipv4List { flowPurged, err := purgeConntrackState(nlh, syscall.AF_INE...
[ "func", "DeleteConntrackEntries", "(", "nlh", "*", "netlink", ".", "Handle", ",", "ipv4List", "[", "]", "net", ".", "IP", ",", "ipv6List", "[", "]", "net", ".", "IP", ")", "(", "uint", ",", "uint", ",", "error", ")", "{", "if", "!", "IsConntrackProgr...
// DeleteConntrackEntries deletes all the conntrack connections on the host for the specified IP // Returns the number of flows deleted for IPv4, IPv6 else error
[ "DeleteConntrackEntries", "deletes", "all", "the", "conntrack", "connections", "on", "the", "host", "for", "the", "specified", "IP", "Returns", "the", "number", "of", "flows", "deleted", "for", "IPv4", "IPv6", "else", "error" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/conntrack.go#L24-L51
train
docker/libnetwork
client/service.go
CmdServicePublish
func (cli *NetworkCli) CmdServicePublish(chain string, args ...string) error { cmd := cli.Subcmd(chain, "publish", "SERVICE[.NETWORK]", "Publish a new service on a network", false) flAlias := opts.NewListOpts(netutils.ValidateAlias) cmd.Var(&flAlias, []string{"-alias"}, "Add alias to self") cmd.Require(flag.Exact, ...
go
func (cli *NetworkCli) CmdServicePublish(chain string, args ...string) error { cmd := cli.Subcmd(chain, "publish", "SERVICE[.NETWORK]", "Publish a new service on a network", false) flAlias := opts.NewListOpts(netutils.ValidateAlias) cmd.Var(&flAlias, []string{"-alias"}, "Add alias to self") cmd.Require(flag.Exact, ...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdServicePublish", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fals...
// CmdServicePublish handles service create UI
[ "CmdServicePublish", "handles", "service", "create", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L165-L190
train
docker/libnetwork
client/service.go
CmdServiceUnpublish
func (cli *NetworkCli) CmdServiceUnpublish(chain string, args ...string) error { cmd := cli.Subcmd(chain, "unpublish", "SERVICE[.NETWORK]", "Removes a service", false) force := cmd.Bool([]string{"f", "-force"}, false, "force unpublish service") cmd.Require(flag.Exact, 1) err := cmd.ParseFlags(args, true) if err !=...
go
func (cli *NetworkCli) CmdServiceUnpublish(chain string, args ...string) error { cmd := cli.Subcmd(chain, "unpublish", "SERVICE[.NETWORK]", "Removes a service", false) force := cmd.Bool([]string{"f", "-force"}, false, "force unpublish service") cmd.Require(flag.Exact, 1) err := cmd.ParseFlags(args, true) if err !=...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdServiceUnpublish", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "fa...
// CmdServiceUnpublish handles service delete UI
[ "CmdServiceUnpublish", "handles", "service", "delete", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L193-L212
train
docker/libnetwork
client/service.go
CmdServiceLs
func (cli *NetworkCli) CmdServiceLs(chain string, args ...string) error { cmd := cli.Subcmd(chain, "ls", "SERVICE", "Lists all the services on a network", false) flNetwork := cmd.String([]string{"net", "-network"}, "", "Only show the services that are published on the specified network") quiet := cmd.Bool([]string{"...
go
func (cli *NetworkCli) CmdServiceLs(chain string, args ...string) error { cmd := cli.Subcmd(chain, "ls", "SERVICE", "Lists all the services on a network", false) flNetwork := cmd.String([]string{"net", "-network"}, "", "Only show the services that are published on the specified network") quiet := cmd.Bool([]string{"...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdServiceLs", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false", ...
// CmdServiceLs handles service list UI
[ "CmdServiceLs", "handles", "service", "list", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L215-L269
train
docker/libnetwork
client/service.go
CmdServiceInfo
func (cli *NetworkCli) CmdServiceInfo(chain string, args ...string) error { cmd := cli.Subcmd(chain, "info", "SERVICE[.NETWORK]", "Displays detailed information about a service", false) cmd.Require(flag.Min, 1) err := cmd.ParseFlags(args, true) if err != nil { return err } sn, nn := parseServiceName(cmd.Arg(0...
go
func (cli *NetworkCli) CmdServiceInfo(chain string, args ...string) error { cmd := cli.Subcmd(chain, "info", "SERVICE[.NETWORK]", "Displays detailed information about a service", false) cmd.Require(flag.Min, 1) err := cmd.ParseFlags(args, true) if err != nil { return err } sn, nn := parseServiceName(cmd.Arg(0...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdServiceInfo", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false",...
// CmdServiceInfo handles service info UI
[ "CmdServiceInfo", "handles", "service", "info", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L294-L324
train
docker/libnetwork
client/service.go
CmdServiceAttach
func (cli *NetworkCli) CmdServiceAttach(chain string, args ...string) error { cmd := cli.Subcmd(chain, "attach", "CONTAINER SERVICE[.NETWORK]", "Sets a container as a service backend", false) flAlias := opts.NewListOpts(netutils.ValidateAlias) cmd.Var(&flAlias, []string{"-alias"}, "Add alias for another container") ...
go
func (cli *NetworkCli) CmdServiceAttach(chain string, args ...string) error { cmd := cli.Subcmd(chain, "attach", "CONTAINER SERVICE[.NETWORK]", "Sets a container as a service backend", false) flAlias := opts.NewListOpts(netutils.ValidateAlias) cmd.Var(&flAlias, []string{"-alias"}, "Add alias for another container") ...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdServiceAttach", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false...
// CmdServiceAttach handles service attach UI
[ "CmdServiceAttach", "handles", "service", "attach", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L327-L358
train
docker/libnetwork
client/service.go
CmdServiceDetach
func (cli *NetworkCli) CmdServiceDetach(chain string, args ...string) error { cmd := cli.Subcmd(chain, "detach", "CONTAINER SERVICE", "Removes a container from service backend", false) cmd.Require(flag.Min, 2) err := cmd.ParseFlags(args, true) if err != nil { return err } sn, nn := parseServiceName(cmd.Arg(1))...
go
func (cli *NetworkCli) CmdServiceDetach(chain string, args ...string) error { cmd := cli.Subcmd(chain, "detach", "CONTAINER SERVICE", "Removes a container from service backend", false) cmd.Require(flag.Min, 2) err := cmd.ParseFlags(args, true) if err != nil { return err } sn, nn := parseServiceName(cmd.Arg(1))...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdServiceDetach", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false...
// CmdServiceDetach handles service detach UI
[ "CmdServiceDetach", "handles", "service", "detach", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L361-L390
train
docker/libnetwork
ipam/store.go
SetValue
func (aSpace *addrSpace) SetValue(value []byte) error { rc := &addrSpace{subnets: make(map[SubnetKey]*PoolData)} if err := json.Unmarshal(value, rc); err != nil { return err } aSpace.subnets = rc.subnets return nil }
go
func (aSpace *addrSpace) SetValue(value []byte) error { rc := &addrSpace{subnets: make(map[SubnetKey]*PoolData)} if err := json.Unmarshal(value, rc); err != nil { return err } aSpace.subnets = rc.subnets return nil }
[ "func", "(", "aSpace", "*", "addrSpace", ")", "SetValue", "(", "value", "[", "]", "byte", ")", "error", "{", "rc", ":=", "&", "addrSpace", "{", "subnets", ":", "make", "(", "map", "[", "SubnetKey", "]", "*", "PoolData", ")", "}", "\n", "if", "err",...
// SetValue unmarshalls the data from the KV store.
[ "SetValue", "unmarshalls", "the", "data", "from", "the", "KV", "store", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/store.go#L36-L43
train
docker/libnetwork
ipvs/ipvs.go
New
func New(path string) (*Handle, error) { setup() n := netns.None() if path != "" { var err error n, err = netns.GetFromPath(path) if err != nil { return nil, err } } defer n.Close() sock, err := nl.GetNetlinkSocketAt(n, netns.None(), syscall.NETLINK_GENERIC) if err != nil { return nil, err } // ...
go
func New(path string) (*Handle, error) { setup() n := netns.None() if path != "" { var err error n, err = netns.GetFromPath(path) if err != nil { return nil, err } } defer n.Close() sock, err := nl.GetNetlinkSocketAt(n, netns.None(), syscall.NETLINK_GENERIC) if err != nil { return nil, err } // ...
[ "func", "New", "(", "path", "string", ")", "(", "*", "Handle", ",", "error", ")", "{", "setup", "(", ")", "\n\n", "n", ":=", "netns", ".", "None", "(", ")", "\n", "if", "path", "!=", "\"", "\"", "{", "var", "err", "error", "\n", "n", ",", "er...
// New provides a new ipvs handle in the namespace pointed to by the // passed path. It will return a valid handle or an error in case an // error occurred while creating the handle.
[ "New", "provides", "a", "new", "ipvs", "handle", "in", "the", "namespace", "pointed", "to", "by", "the", "passed", "path", ".", "It", "will", "return", "a", "valid", "handle", "or", "an", "error", "in", "case", "an", "error", "occurred", "while", "creati...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L88-L116
train
docker/libnetwork
ipvs/ipvs.go
NewService
func (i *Handle) NewService(s *Service) error { return i.doCmd(s, nil, ipvsCmdNewService) }
go
func (i *Handle) NewService(s *Service) error { return i.doCmd(s, nil, ipvsCmdNewService) }
[ "func", "(", "i", "*", "Handle", ")", "NewService", "(", "s", "*", "Service", ")", "error", "{", "return", "i", ".", "doCmd", "(", "s", ",", "nil", ",", "ipvsCmdNewService", ")", "\n", "}" ]
// NewService creates a new ipvs service in the passed handle.
[ "NewService", "creates", "a", "new", "ipvs", "service", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L127-L129
train
docker/libnetwork
ipvs/ipvs.go
IsServicePresent
func (i *Handle) IsServicePresent(s *Service) bool { return nil == i.doCmd(s, nil, ipvsCmdGetService) }
go
func (i *Handle) IsServicePresent(s *Service) bool { return nil == i.doCmd(s, nil, ipvsCmdGetService) }
[ "func", "(", "i", "*", "Handle", ")", "IsServicePresent", "(", "s", "*", "Service", ")", "bool", "{", "return", "nil", "==", "i", ".", "doCmd", "(", "s", ",", "nil", ",", "ipvsCmdGetService", ")", "\n", "}" ]
// IsServicePresent queries for the ipvs service in the passed handle.
[ "IsServicePresent", "queries", "for", "the", "ipvs", "service", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L132-L134
train
docker/libnetwork
ipvs/ipvs.go
UpdateService
func (i *Handle) UpdateService(s *Service) error { return i.doCmd(s, nil, ipvsCmdSetService) }
go
func (i *Handle) UpdateService(s *Service) error { return i.doCmd(s, nil, ipvsCmdSetService) }
[ "func", "(", "i", "*", "Handle", ")", "UpdateService", "(", "s", "*", "Service", ")", "error", "{", "return", "i", ".", "doCmd", "(", "s", ",", "nil", ",", "ipvsCmdSetService", ")", "\n", "}" ]
// UpdateService updates an already existing service in the passed // handle.
[ "UpdateService", "updates", "an", "already", "existing", "service", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L138-L140
train
docker/libnetwork
ipvs/ipvs.go
DelService
func (i *Handle) DelService(s *Service) error { return i.doCmd(s, nil, ipvsCmdDelService) }
go
func (i *Handle) DelService(s *Service) error { return i.doCmd(s, nil, ipvsCmdDelService) }
[ "func", "(", "i", "*", "Handle", ")", "DelService", "(", "s", "*", "Service", ")", "error", "{", "return", "i", ".", "doCmd", "(", "s", ",", "nil", ",", "ipvsCmdDelService", ")", "\n", "}" ]
// DelService deletes an already existing service in the passed // handle.
[ "DelService", "deletes", "an", "already", "existing", "service", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L144-L146
train
docker/libnetwork
ipvs/ipvs.go
Flush
func (i *Handle) Flush() error { _, err := i.doCmdWithoutAttr(ipvsCmdFlush) return err }
go
func (i *Handle) Flush() error { _, err := i.doCmdWithoutAttr(ipvsCmdFlush) return err }
[ "func", "(", "i", "*", "Handle", ")", "Flush", "(", ")", "error", "{", "_", ",", "err", ":=", "i", ".", "doCmdWithoutAttr", "(", "ipvsCmdFlush", ")", "\n", "return", "err", "\n", "}" ]
// Flush deletes all existing services in the passed // handle.
[ "Flush", "deletes", "all", "existing", "services", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L150-L153
train
docker/libnetwork
ipvs/ipvs.go
NewDestination
func (i *Handle) NewDestination(s *Service, d *Destination) error { return i.doCmd(s, d, ipvsCmdNewDest) }
go
func (i *Handle) NewDestination(s *Service, d *Destination) error { return i.doCmd(s, d, ipvsCmdNewDest) }
[ "func", "(", "i", "*", "Handle", ")", "NewDestination", "(", "s", "*", "Service", ",", "d", "*", "Destination", ")", "error", "{", "return", "i", ".", "doCmd", "(", "s", ",", "d", ",", "ipvsCmdNewDest", ")", "\n", "}" ]
// NewDestination creates a new real server in the passed ipvs // service which should already be existing in the passed handle.
[ "NewDestination", "creates", "a", "new", "real", "server", "in", "the", "passed", "ipvs", "service", "which", "should", "already", "be", "existing", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L157-L159
train
docker/libnetwork
ipvs/ipvs.go
UpdateDestination
func (i *Handle) UpdateDestination(s *Service, d *Destination) error { return i.doCmd(s, d, ipvsCmdSetDest) }
go
func (i *Handle) UpdateDestination(s *Service, d *Destination) error { return i.doCmd(s, d, ipvsCmdSetDest) }
[ "func", "(", "i", "*", "Handle", ")", "UpdateDestination", "(", "s", "*", "Service", ",", "d", "*", "Destination", ")", "error", "{", "return", "i", ".", "doCmd", "(", "s", ",", "d", ",", "ipvsCmdSetDest", ")", "\n", "}" ]
// UpdateDestination updates an already existing real server in the // passed ipvs service in the passed handle.
[ "UpdateDestination", "updates", "an", "already", "existing", "real", "server", "in", "the", "passed", "ipvs", "service", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L163-L165
train
docker/libnetwork
ipvs/ipvs.go
DelDestination
func (i *Handle) DelDestination(s *Service, d *Destination) error { return i.doCmd(s, d, ipvsCmdDelDest) }
go
func (i *Handle) DelDestination(s *Service, d *Destination) error { return i.doCmd(s, d, ipvsCmdDelDest) }
[ "func", "(", "i", "*", "Handle", ")", "DelDestination", "(", "s", "*", "Service", ",", "d", "*", "Destination", ")", "error", "{", "return", "i", ".", "doCmd", "(", "s", ",", "d", ",", "ipvsCmdDelDest", ")", "\n", "}" ]
// DelDestination deletes an already existing real server in the // passed ipvs service in the passed handle.
[ "DelDestination", "deletes", "an", "already", "existing", "real", "server", "in", "the", "passed", "ipvs", "service", "in", "the", "passed", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L169-L171
train
docker/libnetwork
ipvs/ipvs.go
GetDestinations
func (i *Handle) GetDestinations(s *Service) ([]*Destination, error) { return i.doGetDestinationsCmd(s, nil) }
go
func (i *Handle) GetDestinations(s *Service) ([]*Destination, error) { return i.doGetDestinationsCmd(s, nil) }
[ "func", "(", "i", "*", "Handle", ")", "GetDestinations", "(", "s", "*", "Service", ")", "(", "[", "]", "*", "Destination", ",", "error", ")", "{", "return", "i", ".", "doGetDestinationsCmd", "(", "s", ",", "nil", ")", "\n", "}" ]
// GetDestinations returns an array of Destinations configured for this Service
[ "GetDestinations", "returns", "an", "array", "of", "Destinations", "configured", "for", "this", "Service" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L179-L181
train
docker/libnetwork
ipvs/ipvs.go
GetService
func (i *Handle) GetService(s *Service) (*Service, error) { res, err := i.doGetServicesCmd(s) if err != nil { return nil, err } // We are looking for exactly one service otherwise error out if len(res) != 1 { return nil, fmt.Errorf("Expected only one service obtained=%d", len(res)) } return res[0], nil }
go
func (i *Handle) GetService(s *Service) (*Service, error) { res, err := i.doGetServicesCmd(s) if err != nil { return nil, err } // We are looking for exactly one service otherwise error out if len(res) != 1 { return nil, fmt.Errorf("Expected only one service obtained=%d", len(res)) } return res[0], nil }
[ "func", "(", "i", "*", "Handle", ")", "GetService", "(", "s", "*", "Service", ")", "(", "*", "Service", ",", "error", ")", "{", "res", ",", "err", ":=", "i", ".", "doGetServicesCmd", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// GetService gets details of a specific IPVS services, useful in updating statisics etc.,
[ "GetService", "gets", "details", "of", "a", "specific", "IPVS", "services", "useful", "in", "updating", "statisics", "etc", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L184-L197
train
docker/libnetwork
portmapper/mapper.go
NewWithPortAllocator
func NewWithPortAllocator(allocator *portallocator.PortAllocator, proxyPath string) *PortMapper { return &PortMapper{ currentMappings: make(map[string]*mapping), Allocator: allocator, proxyPath: proxyPath, } }
go
func NewWithPortAllocator(allocator *portallocator.PortAllocator, proxyPath string) *PortMapper { return &PortMapper{ currentMappings: make(map[string]*mapping), Allocator: allocator, proxyPath: proxyPath, } }
[ "func", "NewWithPortAllocator", "(", "allocator", "*", "portallocator", ".", "PortAllocator", ",", "proxyPath", "string", ")", "*", "PortMapper", "{", "return", "&", "PortMapper", "{", "currentMappings", ":", "make", "(", "map", "[", "string", "]", "*", "mappi...
// NewWithPortAllocator returns a new instance of PortMapper which will use the specified PortAllocator
[ "NewWithPortAllocator", "returns", "a", "new", "instance", "of", "PortMapper", "which", "will", "use", "the", "specified", "PortAllocator" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper.go#L39-L45
train
docker/libnetwork
portmapper/mapper.go
Map
func (pm *PortMapper) Map(container net.Addr, hostIP net.IP, hostPort int, useProxy bool) (host net.Addr, err error) { return pm.MapRange(container, hostIP, hostPort, hostPort, useProxy) }
go
func (pm *PortMapper) Map(container net.Addr, hostIP net.IP, hostPort int, useProxy bool) (host net.Addr, err error) { return pm.MapRange(container, hostIP, hostPort, hostPort, useProxy) }
[ "func", "(", "pm", "*", "PortMapper", ")", "Map", "(", "container", "net", ".", "Addr", ",", "hostIP", "net", ".", "IP", ",", "hostPort", "int", ",", "useProxy", "bool", ")", "(", "host", "net", ".", "Addr", ",", "err", "error", ")", "{", "return",...
// Map maps the specified container transport address to the host's network address and transport port
[ "Map", "maps", "the", "specified", "container", "transport", "address", "to", "the", "host", "s", "network", "address", "and", "transport", "port" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper.go#L48-L50
train
docker/libnetwork
portmapper/mapper.go
Unmap
func (pm *PortMapper) Unmap(host net.Addr) error { pm.lock.Lock() defer pm.lock.Unlock() key := getKey(host) data, exists := pm.currentMappings[key] if !exists { return ErrPortNotMapped } if data.userlandProxy != nil { data.userlandProxy.Stop() } delete(pm.currentMappings, key) containerIP, containerP...
go
func (pm *PortMapper) Unmap(host net.Addr) error { pm.lock.Lock() defer pm.lock.Unlock() key := getKey(host) data, exists := pm.currentMappings[key] if !exists { return ErrPortNotMapped } if data.userlandProxy != nil { data.userlandProxy.Stop() } delete(pm.currentMappings, key) containerIP, containerP...
[ "func", "(", "pm", "*", "PortMapper", ")", "Unmap", "(", "host", "net", ".", "Addr", ")", "error", "{", "pm", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "pm", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "key", ":=", "getKey", "(", "ho...
// Unmap removes stored mapping for the specified host transport address
[ "Unmap", "removes", "stored", "mapping", "for", "the", "specified", "host", "transport", "address" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper.go#L185-L219
train