id
int32
0
167k
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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
22,600
docker/libnetwork
network.go
MarshalJSON
func (i *IpamInfo) MarshalJSON() ([]byte, error) { m := map[string]interface{}{ "PoolID": i.PoolID, } v, err := json.Marshal(&i.IPAMData) if err != nil { return nil, err } m["IPAMData"] = string(v) if i.Meta != nil { m["Meta"] = i.Meta } return json.Marshal(m) }
go
func (i *IpamInfo) MarshalJSON() ([]byte, error) { m := map[string]interface{}{ "PoolID": i.PoolID, } v, err := json.Marshal(&i.IPAMData) if err != nil { return nil, err } m["IPAMData"] = string(v) if i.Meta != nil { m["Meta"] = i.Meta } return json.Marshal(m) }
[ "func", "(", "i", "*", "IpamInfo", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "m", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "i", ".", "PoolID", ",", "}", "\n", "v", ",", ...
// MarshalJSON encodes IpamInfo into json message
[ "MarshalJSON", "encodes", "IpamInfo", "into", "json", "message" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L161-L175
22,601
docker/libnetwork
network.go
UnmarshalJSON
func (i *IpamInfo) UnmarshalJSON(data []byte) error { var ( m map[string]interface{} err error ) if err = json.Unmarshal(data, &m); err != nil { return err } i.PoolID = m["PoolID"].(string) if v, ok := m["Meta"]; ok { b, _ := json.Marshal(v) if err = json.Unmarshal(b, &i.Meta); err != nil { return ...
go
func (i *IpamInfo) UnmarshalJSON(data []byte) error { var ( m map[string]interface{} err error ) if err = json.Unmarshal(data, &m); err != nil { return err } i.PoolID = m["PoolID"].(string) if v, ok := m["Meta"]; ok { b, _ := json.Marshal(v) if err = json.Unmarshal(b, &i.Meta); err != nil { return ...
[ "func", "(", "i", "*", "IpamInfo", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "(", "m", "map", "[", "string", "]", "interface", "{", "}", "\n", "err", "error", "\n", ")", "\n", "if", "err", "=", "json", ".", ...
// UnmarshalJSON decodes json message into PoolData
[ "UnmarshalJSON", "decodes", "json", "message", "into", "PoolData" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L178-L199
22,602
docker/libnetwork
network.go
CopyTo
func (c *IpamConf) CopyTo(dstC *IpamConf) error { dstC.PreferredPool = c.PreferredPool dstC.SubPool = c.SubPool dstC.Gateway = c.Gateway if c.AuxAddresses != nil { dstC.AuxAddresses = make(map[string]string, len(c.AuxAddresses)) for k, v := range c.AuxAddresses { dstC.AuxAddresses[k] = v } } return nil }
go
func (c *IpamConf) CopyTo(dstC *IpamConf) error { dstC.PreferredPool = c.PreferredPool dstC.SubPool = c.SubPool dstC.Gateway = c.Gateway if c.AuxAddresses != nil { dstC.AuxAddresses = make(map[string]string, len(c.AuxAddresses)) for k, v := range c.AuxAddresses { dstC.AuxAddresses[k] = v } } return nil }
[ "func", "(", "c", "*", "IpamConf", ")", "CopyTo", "(", "dstC", "*", "IpamConf", ")", "error", "{", "dstC", ".", "PreferredPool", "=", "c", ".", "PreferredPool", "\n", "dstC", ".", "SubPool", "=", "c", ".", "SubPool", "\n", "dstC", ".", "Gateway", "="...
// CopyTo deep copies to the destination IpamConfig
[ "CopyTo", "deep", "copies", "to", "the", "destination", "IpamConfig" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L335-L346
22,603
docker/libnetwork
network.go
CopyTo
func (i *IpamInfo) CopyTo(dstI *IpamInfo) error { dstI.PoolID = i.PoolID if i.Meta != nil { dstI.Meta = make(map[string]string) for k, v := range i.Meta { dstI.Meta[k] = v } } dstI.AddressSpace = i.AddressSpace dstI.Pool = types.GetIPNetCopy(i.Pool) dstI.Gateway = types.GetIPNetCopy(i.Gateway) if i.Au...
go
func (i *IpamInfo) CopyTo(dstI *IpamInfo) error { dstI.PoolID = i.PoolID if i.Meta != nil { dstI.Meta = make(map[string]string) for k, v := range i.Meta { dstI.Meta[k] = v } } dstI.AddressSpace = i.AddressSpace dstI.Pool = types.GetIPNetCopy(i.Pool) dstI.Gateway = types.GetIPNetCopy(i.Gateway) if i.Au...
[ "func", "(", "i", "*", "IpamInfo", ")", "CopyTo", "(", "dstI", "*", "IpamInfo", ")", "error", "{", "dstI", ".", "PoolID", "=", "i", ".", "PoolID", "\n", "if", "i", ".", "Meta", "!=", "nil", "{", "dstI", ".", "Meta", "=", "make", "(", "map", "["...
// CopyTo deep copies to the destination IpamInfo
[ "CopyTo", "deep", "copies", "to", "the", "destination", "IpamInfo" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L349-L370
22,604
docker/libnetwork
network.go
applyConfigurationTo
func (n *network) applyConfigurationTo(to *network) error { to.enableIPv6 = n.enableIPv6 if len(n.labels) > 0 { to.labels = make(map[string]string, len(n.labels)) for k, v := range n.labels { if _, ok := to.labels[k]; !ok { to.labels[k] = v } } } if len(n.ipamType) != 0 { to.ipamType = n.ipamType ...
go
func (n *network) applyConfigurationTo(to *network) error { to.enableIPv6 = n.enableIPv6 if len(n.labels) > 0 { to.labels = make(map[string]string, len(n.labels)) for k, v := range n.labels { if _, ok := to.labels[k]; !ok { to.labels[k] = v } } } if len(n.ipamType) != 0 { to.ipamType = n.ipamType ...
[ "func", "(", "n", "*", "network", ")", "applyConfigurationTo", "(", "to", "*", "network", ")", "error", "{", "to", ".", "enableIPv6", "=", "n", ".", "enableIPv6", "\n", "if", "len", "(", "n", ".", "labels", ")", ">", "0", "{", "to", ".", "labels", ...
// Applies network specific configurations
[ "Applies", "network", "specific", "configurations" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L420-L456
22,605
docker/libnetwork
network.go
NetworkOptionGeneric
func NetworkOptionGeneric(generic map[string]interface{}) NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } if val, ok := generic[netlabel.EnableIPv6]; ok { n.enableIPv6 = val.(bool) } if val, ok := generic[netlabel.Internal]; ok { n.internal ...
go
func NetworkOptionGeneric(generic map[string]interface{}) NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } if val, ok := generic[netlabel.EnableIPv6]; ok { n.enableIPv6 = val.(bool) } if val, ok := generic[netlabel.Internal]; ok { n.internal ...
[ "func", "NetworkOptionGeneric", "(", "generic", "map", "[", "string", "]", "interface", "{", "}", ")", "NetworkOption", "{", "return", "func", "(", "n", "*", "network", ")", "{", "if", "n", ".", "generic", "==", "nil", "{", "n", ".", "generic", "=", ...
// NetworkOptionGeneric function returns an option setter for a Generic option defined // in a Dictionary of Key-Value pair
[ "NetworkOptionGeneric", "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/network.go#L733-L748
22,606
docker/libnetwork
network.go
NetworkOptionEnableIPv6
func NetworkOptionEnableIPv6(enableIPv6 bool) NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } n.enableIPv6 = enableIPv6 n.generic[netlabel.EnableIPv6] = enableIPv6 } }
go
func NetworkOptionEnableIPv6(enableIPv6 bool) NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } n.enableIPv6 = enableIPv6 n.generic[netlabel.EnableIPv6] = enableIPv6 } }
[ "func", "NetworkOptionEnableIPv6", "(", "enableIPv6", "bool", ")", "NetworkOption", "{", "return", "func", "(", "n", "*", "network", ")", "{", "if", "n", ".", "generic", "==", "nil", "{", "n", ".", "generic", "=", "make", "(", "map", "[", "string", "]"...
// NetworkOptionEnableIPv6 returns an option setter to explicitly configure IPv6
[ "NetworkOptionEnableIPv6", "returns", "an", "option", "setter", "to", "explicitly", "configure", "IPv6" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L766-L774
22,607
docker/libnetwork
network.go
NetworkOptionInternalNetwork
func NetworkOptionInternalNetwork() NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } n.internal = true n.generic[netlabel.Internal] = true } }
go
func NetworkOptionInternalNetwork() NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } n.internal = true n.generic[netlabel.Internal] = true } }
[ "func", "NetworkOptionInternalNetwork", "(", ")", "NetworkOption", "{", "return", "func", "(", "n", "*", "network", ")", "{", "if", "n", ".", "generic", "==", "nil", "{", "n", ".", "generic", "=", "make", "(", "map", "[", "string", "]", "interface", "{...
// NetworkOptionInternalNetwork returns an option setter to config the network // to be internal which disables default gateway service
[ "NetworkOptionInternalNetwork", "returns", "an", "option", "setter", "to", "config", "the", "network", "to", "be", "internal", "which", "disables", "default", "gateway", "service" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L778-L786
22,608
docker/libnetwork
network.go
NetworkOptionIpam
func NetworkOptionIpam(ipamDriver string, addrSpace string, ipV4 []*IpamConf, ipV6 []*IpamConf, opts map[string]string) NetworkOption { return func(n *network) { if ipamDriver != "" { n.ipamType = ipamDriver if ipamDriver == ipamapi.DefaultIPAM { n.ipamType = defaultIpamForNetworkType(n.Type()) } } ...
go
func NetworkOptionIpam(ipamDriver string, addrSpace string, ipV4 []*IpamConf, ipV6 []*IpamConf, opts map[string]string) NetworkOption { return func(n *network) { if ipamDriver != "" { n.ipamType = ipamDriver if ipamDriver == ipamapi.DefaultIPAM { n.ipamType = defaultIpamForNetworkType(n.Type()) } } ...
[ "func", "NetworkOptionIpam", "(", "ipamDriver", "string", ",", "addrSpace", "string", ",", "ipV4", "[", "]", "*", "IpamConf", ",", "ipV6", "[", "]", "*", "IpamConf", ",", "opts", "map", "[", "string", "]", "string", ")", "NetworkOption", "{", "return", "...
// NetworkOptionIpam function returns an option setter for the ipam configuration for this network
[ "NetworkOptionIpam", "function", "returns", "an", "option", "setter", "for", "the", "ipam", "configuration", "for", "this", "network" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L804-L817
22,609
docker/libnetwork
network.go
NetworkOptionLBEndpoint
func NetworkOptionLBEndpoint(ip net.IP) NetworkOption { return func(n *network) { n.loadBalancerIP = ip } }
go
func NetworkOptionLBEndpoint(ip net.IP) NetworkOption { return func(n *network) { n.loadBalancerIP = ip } }
[ "func", "NetworkOptionLBEndpoint", "(", "ip", "net", ".", "IP", ")", "NetworkOption", "{", "return", "func", "(", "n", "*", "network", ")", "{", "n", ".", "loadBalancerIP", "=", "ip", "\n", "}", "\n", "}" ]
// NetworkOptionLBEndpoint function returns an option setter for the configuration of the load balancer endpoint for this network
[ "NetworkOptionLBEndpoint", "function", "returns", "an", "option", "setter", "for", "the", "configuration", "of", "the", "load", "balancer", "endpoint", "for", "this", "network" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L820-L824
22,610
docker/libnetwork
network.go
NetworkOptionDriverOpts
func NetworkOptionDriverOpts(opts map[string]string) NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } if opts == nil { opts = make(map[string]string) } // Store the options n.generic[netlabel.GenericData] = opts } }
go
func NetworkOptionDriverOpts(opts map[string]string) NetworkOption { return func(n *network) { if n.generic == nil { n.generic = make(map[string]interface{}) } if opts == nil { opts = make(map[string]string) } // Store the options n.generic[netlabel.GenericData] = opts } }
[ "func", "NetworkOptionDriverOpts", "(", "opts", "map", "[", "string", "]", "string", ")", "NetworkOption", "{", "return", "func", "(", "n", "*", "network", ")", "{", "if", "n", ".", "generic", "==", "nil", "{", "n", ".", "generic", "=", "make", "(", ...
// NetworkOptionDriverOpts function returns an option setter for any driver parameter described by a map
[ "NetworkOptionDriverOpts", "function", "returns", "an", "option", "setter", "for", "any", "driver", "parameter", "described", "by", "a", "map" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L827-L838
22,611
docker/libnetwork
network.go
NetworkOptionLabels
func NetworkOptionLabels(labels map[string]string) NetworkOption { return func(n *network) { n.labels = labels } }
go
func NetworkOptionLabels(labels map[string]string) NetworkOption { return func(n *network) { n.labels = labels } }
[ "func", "NetworkOptionLabels", "(", "labels", "map", "[", "string", "]", "string", ")", "NetworkOption", "{", "return", "func", "(", "n", "*", "network", ")", "{", "n", ".", "labels", "=", "labels", "\n", "}", "\n", "}" ]
// NetworkOptionLabels function returns an option setter for labels specific to a network
[ "NetworkOptionLabels", "function", "returns", "an", "option", "setter", "for", "labels", "specific", "to", "a", "network" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L841-L845
22,612
docker/libnetwork
network.go
getConfigNetwork
func (c *controller) getConfigNetwork(name string) (*network, error) { var n Network s := func(current Network) bool { if current.Info().ConfigOnly() && current.Name() == name { n = current return true } return false } c.WalkNetworks(s) if n == nil { return nil, types.NotFoundErrorf("configuration...
go
func (c *controller) getConfigNetwork(name string) (*network, error) { var n Network s := func(current Network) bool { if current.Info().ConfigOnly() && current.Name() == name { n = current return true } return false } c.WalkNetworks(s) if n == nil { return nil, types.NotFoundErrorf("configuration...
[ "func", "(", "c", "*", "controller", ")", "getConfigNetwork", "(", "name", "string", ")", "(", "*", "network", ",", "error", ")", "{", "var", "n", "Network", "\n\n", "s", ":=", "func", "(", "current", "Network", ")", "bool", "{", "if", "current", "."...
// config-only network is looked up by name
[ "config", "-", "only", "network", "is", "looked", "up", "by", "name" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L2105-L2123
22,613
docker/libnetwork
iptables/iptables.go
NewChain
func NewChain(name string, table Table, hairpinMode bool) (*ChainInfo, error) { c := &ChainInfo{ Name: name, Table: table, HairpinMode: hairpinMode, } if string(c.Table) == "" { c.Table = Filter } // Add chain if it doesn't exist if _, err := Raw("-t", string(c.Table), "-n", "-L", c.Name); e...
go
func NewChain(name string, table Table, hairpinMode bool) (*ChainInfo, error) { c := &ChainInfo{ Name: name, Table: table, HairpinMode: hairpinMode, } if string(c.Table) == "" { c.Table = Filter } // Add chain if it doesn't exist if _, err := Raw("-t", string(c.Table), "-n", "-L", c.Name); e...
[ "func", "NewChain", "(", "name", "string", ",", "table", "Table", ",", "hairpinMode", "bool", ")", "(", "*", "ChainInfo", ",", "error", ")", "{", "c", ":=", "&", "ChainInfo", "{", "Name", ":", "name", ",", "Table", ":", "table", ",", "HairpinMode", "...
// NewChain adds a new chain to ip table.
[ "NewChain", "adds", "a", "new", "chain", "to", "ip", "table", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L120-L139
22,614
docker/libnetwork
iptables/iptables.go
RemoveExistingChain
func RemoveExistingChain(name string, table Table) error { c := &ChainInfo{ Name: name, Table: table, } if string(c.Table) == "" { c.Table = Filter } return c.Remove() }
go
func RemoveExistingChain(name string, table Table) error { c := &ChainInfo{ Name: name, Table: table, } if string(c.Table) == "" { c.Table = Filter } return c.Remove() }
[ "func", "RemoveExistingChain", "(", "name", "string", ",", "table", "Table", ")", "error", "{", "c", ":=", "&", "ChainInfo", "{", "Name", ":", "name", ",", "Table", ":", "table", ",", "}", "\n", "if", "string", "(", "c", ".", "Table", ")", "==", "\...
// RemoveExistingChain removes existing chain from the table.
[ "RemoveExistingChain", "removes", "existing", "chain", "from", "the", "table", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L227-L236
22,615
docker/libnetwork
iptables/iptables.go
Forward
func (c *ChainInfo) Forward(action Action, ip net.IP, port int, proto, destAddr string, destPort int, bridgeName string) error { daddr := ip.String() if ip.IsUnspecified() { // iptables interprets "0.0.0.0" as "0.0.0.0/32", whereas we // want "0.0.0.0/0". "0/0" is correctly interpreted as "any // value" by both...
go
func (c *ChainInfo) Forward(action Action, ip net.IP, port int, proto, destAddr string, destPort int, bridgeName string) error { daddr := ip.String() if ip.IsUnspecified() { // iptables interprets "0.0.0.0" as "0.0.0.0/32", whereas we // want "0.0.0.0/0". "0/0" is correctly interpreted as "any // value" by both...
[ "func", "(", "c", "*", "ChainInfo", ")", "Forward", "(", "action", "Action", ",", "ip", "net", ".", "IP", ",", "port", "int", ",", "proto", ",", "destAddr", "string", ",", "destPort", "int", ",", "bridgeName", "string", ")", "error", "{", "daddr", ":...
// Forward adds forwarding rule to 'filter' table and corresponding nat rule to 'nat' table.
[ "Forward", "adds", "forwarding", "rule", "to", "filter", "table", "and", "corresponding", "nat", "rule", "to", "nat", "table", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L239-L305
22,616
docker/libnetwork
iptables/iptables.go
Link
func (c *ChainInfo) Link(action Action, ip1, ip2 net.IP, port int, proto string, bridgeName string) error { // forward args := []string{ "-i", bridgeName, "-o", bridgeName, "-p", proto, "-s", ip1.String(), "-d", ip2.String(), "--dport", strconv.Itoa(port), "-j", "ACCEPT", } if err := ProgramRule(Filter,...
go
func (c *ChainInfo) Link(action Action, ip1, ip2 net.IP, port int, proto string, bridgeName string) error { // forward args := []string{ "-i", bridgeName, "-o", bridgeName, "-p", proto, "-s", ip1.String(), "-d", ip2.String(), "--dport", strconv.Itoa(port), "-j", "ACCEPT", } if err := ProgramRule(Filter,...
[ "func", "(", "c", "*", "ChainInfo", ")", "Link", "(", "action", "Action", ",", "ip1", ",", "ip2", "net", ".", "IP", ",", "port", "int", ",", "proto", "string", ",", "bridgeName", "string", ")", "error", "{", "// forward", "args", ":=", "[", "]", "s...
// Link adds reciprocal ACCEPT rule for two supplied IP addresses. // Traffic is allowed from ip1 to ip2 and vice-versa
[ "Link", "adds", "reciprocal", "ACCEPT", "rule", "for", "two", "supplied", "IP", "addresses", ".", "Traffic", "is", "allowed", "from", "ip1", "to", "ip2", "and", "vice", "-", "versa" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L309-L326
22,617
docker/libnetwork
iptables/iptables.go
ProgramRule
func ProgramRule(table Table, chain string, action Action, args []string) error { if Exists(table, chain, args...) != (action == Delete) { return nil } return RawCombinedOutput(append([]string{"-t", string(table), string(action), chain}, args...)...) }
go
func ProgramRule(table Table, chain string, action Action, args []string) error { if Exists(table, chain, args...) != (action == Delete) { return nil } return RawCombinedOutput(append([]string{"-t", string(table), string(action), chain}, args...)...) }
[ "func", "ProgramRule", "(", "table", "Table", ",", "chain", "string", ",", "action", "Action", ",", "args", "[", "]", "string", ")", "error", "{", "if", "Exists", "(", "table", ",", "chain", ",", "args", "...", ")", "!=", "(", "action", "==", "Delete...
// ProgramRule adds the rule specified by args only if the // rule is not already present in the chain. Reciprocally, // it removes the rule only if present.
[ "ProgramRule", "adds", "the", "rule", "specified", "by", "args", "only", "if", "the", "rule", "is", "not", "already", "present", "in", "the", "chain", ".", "Reciprocally", "it", "removes", "the", "rule", "only", "if", "present", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L331-L336
22,618
docker/libnetwork
iptables/iptables.go
Remove
func (c *ChainInfo) Remove() error { // Ignore errors - This could mean the chains were never set up if c.Table == Nat { c.Prerouting(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "-j", c.Name) c.Output(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "!", "--dst", "127.0.0.0/8", "-j", c.Name) c.Output(Delet...
go
func (c *ChainInfo) Remove() error { // Ignore errors - This could mean the chains were never set up if c.Table == Nat { c.Prerouting(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "-j", c.Name) c.Output(Delete, "-m", "addrtype", "--dst-type", "LOCAL", "!", "--dst", "127.0.0.0/8", "-j", c.Name) c.Output(Delet...
[ "func", "(", "c", "*", "ChainInfo", ")", "Remove", "(", ")", "error", "{", "// Ignore errors - This could mean the chains were never set up", "if", "c", ".", "Table", "==", "Nat", "{", "c", ".", "Prerouting", "(", "Delete", ",", "\"", "\"", ",", "\"", "\"", ...
// Remove removes the chain.
[ "Remove", "removes", "the", "chain", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L367-L380
22,619
docker/libnetwork
iptables/iptables.go
Exists
func Exists(table Table, chain string, rule ...string) bool { return exists(false, table, chain, rule...) }
go
func Exists(table Table, chain string, rule ...string) bool { return exists(false, table, chain, rule...) }
[ "func", "Exists", "(", "table", "Table", ",", "chain", "string", ",", "rule", "...", "string", ")", "bool", "{", "return", "exists", "(", "false", ",", "table", ",", "chain", ",", "rule", "...", ")", "\n", "}" ]
// Exists checks if a rule exists
[ "Exists", "checks", "if", "a", "rule", "exists" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L383-L385
22,620
docker/libnetwork
iptables/iptables.go
ExistsNative
func ExistsNative(table Table, chain string, rule ...string) bool { return exists(true, table, chain, rule...) }
go
func ExistsNative(table Table, chain string, rule ...string) bool { return exists(true, table, chain, rule...) }
[ "func", "ExistsNative", "(", "table", "Table", ",", "chain", "string", ",", "rule", "...", "string", ")", "bool", "{", "return", "exists", "(", "true", ",", "table", ",", "chain", ",", "rule", "...", ")", "\n", "}" ]
// ExistsNative behaves as Exists with the difference it // will always invoke `iptables` binary.
[ "ExistsNative", "behaves", "as", "Exists", "with", "the", "difference", "it", "will", "always", "invoke", "iptables", "binary", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L389-L391
22,621
docker/libnetwork
iptables/iptables.go
Raw
func Raw(args ...string) ([]byte, error) { if firewalldRunning { startTime := time.Now() output, err := Passthrough(Iptables, args...) if err == nil || !strings.Contains(err.Error(), "was not provided by any .service files") { return filterOutput(startTime, output, args...), err } } return raw(args...) }
go
func Raw(args ...string) ([]byte, error) { if firewalldRunning { startTime := time.Now() output, err := Passthrough(Iptables, args...) if err == nil || !strings.Contains(err.Error(), "was not provided by any .service files") { return filterOutput(startTime, output, args...), err } } return raw(args...) }
[ "func", "Raw", "(", "args", "...", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "firewalldRunning", "{", "startTime", ":=", "time", ".", "Now", "(", ")", "\n", "output", ",", "err", ":=", "Passthrough", "(", "Iptables", ",", ...
// Raw calls 'iptables' system command, passing supplied arguments.
[ "Raw", "calls", "iptables", "system", "command", "passing", "supplied", "arguments", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L447-L456
22,622
docker/libnetwork
iptables/iptables.go
RawCombinedOutput
func RawCombinedOutput(args ...string) error { if output, err := Raw(args...); err != nil || len(output) != 0 { return fmt.Errorf("%s (%v)", string(output), err) } return nil }
go
func RawCombinedOutput(args ...string) error { if output, err := Raw(args...); err != nil || len(output) != 0 { return fmt.Errorf("%s (%v)", string(output), err) } return nil }
[ "func", "RawCombinedOutput", "(", "args", "...", "string", ")", "error", "{", "if", "output", ",", "err", ":=", "Raw", "(", "args", "...", ")", ";", "err", "!=", "nil", "||", "len", "(", "output", ")", "!=", "0", "{", "return", "fmt", ".", "Errorf"...
// RawCombinedOutput internally calls the Raw function and returns a non nil // error if Raw returned a non nil error or a non empty output
[ "RawCombinedOutput", "internally", "calls", "the", "Raw", "function", "and", "returns", "a", "non", "nil", "error", "if", "Raw", "returned", "a", "non", "nil", "error", "or", "a", "non", "empty", "output" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L482-L487
22,623
docker/libnetwork
iptables/iptables.go
RawCombinedOutputNative
func RawCombinedOutputNative(args ...string) error { if output, err := raw(args...); err != nil || len(output) != 0 { return fmt.Errorf("%s (%v)", string(output), err) } return nil }
go
func RawCombinedOutputNative(args ...string) error { if output, err := raw(args...); err != nil || len(output) != 0 { return fmt.Errorf("%s (%v)", string(output), err) } return nil }
[ "func", "RawCombinedOutputNative", "(", "args", "...", "string", ")", "error", "{", "if", "output", ",", "err", ":=", "raw", "(", "args", "...", ")", ";", "err", "!=", "nil", "||", "len", "(", "output", ")", "!=", "0", "{", "return", "fmt", ".", "E...
// RawCombinedOutputNative behave as RawCombinedOutput with the difference it // will always invoke `iptables` binary
[ "RawCombinedOutputNative", "behave", "as", "RawCombinedOutput", "with", "the", "difference", "it", "will", "always", "invoke", "iptables", "binary" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L491-L496
22,624
docker/libnetwork
iptables/iptables.go
ExistChain
func ExistChain(chain string, table Table) bool { if _, err := Raw("-t", string(table), "-nL", chain); err == nil { return true } return false }
go
func ExistChain(chain string, table Table) bool { if _, err := Raw("-t", string(table), "-nL", chain); err == nil { return true } return false }
[ "func", "ExistChain", "(", "chain", "string", ",", "table", "Table", ")", "bool", "{", "if", "_", ",", "err", ":=", "Raw", "(", "\"", "\"", ",", "string", "(", "table", ")", ",", "\"", "\"", ",", "chain", ")", ";", "err", "==", "nil", "{", "ret...
// ExistChain checks if a chain exists
[ "ExistChain", "checks", "if", "a", "chain", "exists" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L499-L504
22,625
docker/libnetwork
iptables/iptables.go
GetVersion
func GetVersion() (major, minor, micro int, err error) { out, err := exec.Command(iptablesPath, "--version").CombinedOutput() if err == nil { major, minor, micro = parseVersionNumbers(string(out)) } return }
go
func GetVersion() (major, minor, micro int, err error) { out, err := exec.Command(iptablesPath, "--version").CombinedOutput() if err == nil { major, minor, micro = parseVersionNumbers(string(out)) } return }
[ "func", "GetVersion", "(", ")", "(", "major", ",", "minor", ",", "micro", "int", ",", "err", "error", ")", "{", "out", ",", "err", ":=", "exec", ".", "Command", "(", "iptablesPath", ",", "\"", "\"", ")", ".", "CombinedOutput", "(", ")", "\n", "if",...
// GetVersion reads the iptables version numbers during initialization
[ "GetVersion", "reads", "the", "iptables", "version", "numbers", "during", "initialization" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L507-L513
22,626
docker/libnetwork
iptables/iptables.go
AddReturnRule
func AddReturnRule(chain string) error { var ( table = Filter args = []string{"-j", "RETURN"} ) if Exists(table, chain, args...) { return nil } err := RawCombinedOutput(append([]string{"-A", chain}, args...)...) if err != nil { return fmt.Errorf("unable to add return rule in %s chain: %s", chain, err.E...
go
func AddReturnRule(chain string) error { var ( table = Filter args = []string{"-j", "RETURN"} ) if Exists(table, chain, args...) { return nil } err := RawCombinedOutput(append([]string{"-A", chain}, args...)...) if err != nil { return fmt.Errorf("unable to add return rule in %s chain: %s", chain, err.E...
[ "func", "AddReturnRule", "(", "chain", "string", ")", "error", "{", "var", "(", "table", "=", "Filter", "\n", "args", "=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", ")", "\n\n", "if", "Exists", "(", "table", ",", "chain", "...
// AddReturnRule adds a return rule for the chain in the filter table
[ "AddReturnRule", "adds", "a", "return", "rule", "for", "the", "chain", "in", "the", "filter", "table" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L537-L553
22,627
docker/libnetwork
iptables/iptables.go
EnsureJumpRule
func EnsureJumpRule(fromChain, toChain string) error { var ( table = Filter args = []string{"-j", toChain} ) if Exists(table, fromChain, args...) { err := RawCombinedOutput(append([]string{"-D", fromChain}, args...)...) if err != nil { return fmt.Errorf("unable to remove jump to %s rule in %s chain: %s"...
go
func EnsureJumpRule(fromChain, toChain string) error { var ( table = Filter args = []string{"-j", toChain} ) if Exists(table, fromChain, args...) { err := RawCombinedOutput(append([]string{"-D", fromChain}, args...)...) if err != nil { return fmt.Errorf("unable to remove jump to %s rule in %s chain: %s"...
[ "func", "EnsureJumpRule", "(", "fromChain", ",", "toChain", "string", ")", "error", "{", "var", "(", "table", "=", "Filter", "\n", "args", "=", "[", "]", "string", "{", "\"", "\"", ",", "toChain", "}", "\n", ")", "\n\n", "if", "Exists", "(", "table",...
// EnsureJumpRule ensures the jump rule is on top
[ "EnsureJumpRule", "ensures", "the", "jump", "rule", "is", "on", "top" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/iptables.go#L556-L575
22,628
docker/libnetwork
client/network.go
CmdNetwork
func (cli *NetworkCli) CmdNetwork(chain string, args ...string) error { cmd := cli.Subcmd(chain, "network", "COMMAND [OPTIONS] [arg...]", networkUsage(chain), false) cmd.Require(flag.Min, 1) err := cmd.ParseFlags(args, true) if err == nil { cmd.Usage() return fmt.Errorf("invalid command : %v", args) } return ...
go
func (cli *NetworkCli) CmdNetwork(chain string, args ...string) error { cmd := cli.Subcmd(chain, "network", "COMMAND [OPTIONS] [arg...]", networkUsage(chain), false) cmd.Require(flag.Min, 1) err := cmd.ParseFlags(args, true) if err == nil { cmd.Usage() return fmt.Errorf("invalid command : %v", args) } return ...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdNetwork", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "networkUsage", "(", "chain", ...
// CmdNetwork handles the root Network UI
[ "CmdNetwork", "handles", "the", "root", "Network", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/network.go#L31-L40
22,629
docker/libnetwork
client/network.go
CmdNetworkCreate
func (cli *NetworkCli) CmdNetworkCreate(chain string, args ...string) error { cmd := cli.Subcmd(chain, "create", "NETWORK-NAME", "Creates a new network with a name specified by the user", false) flDriver := cmd.String([]string{"d", "-driver"}, "", "Driver to manage the Network") flID := cmd.String([]string{"-id"}, "...
go
func (cli *NetworkCli) CmdNetworkCreate(chain string, args ...string) error { cmd := cli.Subcmd(chain, "create", "NETWORK-NAME", "Creates a new network with a name specified by the user", false) flDriver := cmd.String([]string{"d", "-driver"}, "", "Driver to manage the Network") flID := cmd.String([]string{"-id"}, "...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdNetworkCreate", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false...
// CmdNetworkCreate handles Network Create UI
[ "CmdNetworkCreate", "handles", "Network", "Create", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/network.go#L43-L100
22,630
docker/libnetwork
client/network.go
CmdNetworkRm
func (cli *NetworkCli) CmdNetworkRm(chain string, args ...string) error { cmd := cli.Subcmd(chain, "rm", "NETWORK", "Deletes a network", false) cmd.Require(flag.Exact, 1) err := cmd.ParseFlags(args, true) if err != nil { return err } id, err := lookupNetworkID(cli, cmd.Arg(0)) if err != nil { return err } ...
go
func (cli *NetworkCli) CmdNetworkRm(chain string, args ...string) error { cmd := cli.Subcmd(chain, "rm", "NETWORK", "Deletes a network", false) cmd.Require(flag.Exact, 1) err := cmd.ParseFlags(args, true) if err != nil { return err } id, err := lookupNetworkID(cli, cmd.Arg(0)) if err != nil { return err } ...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdNetworkRm", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false", ...
// CmdNetworkRm handles Network Delete UI
[ "CmdNetworkRm", "handles", "Network", "Delete", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/network.go#L103-L119
22,631
docker/libnetwork
client/network.go
CmdNetworkLs
func (cli *NetworkCli) CmdNetworkLs(chain string, args ...string) error { cmd := cli.Subcmd(chain, "ls", "", "Lists all the networks created by the user", false) quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only display numeric IDs") noTrunc := cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Do not truncat...
go
func (cli *NetworkCli) CmdNetworkLs(chain string, args ...string) error { cmd := cli.Subcmd(chain, "ls", "", "Lists all the networks created by the user", false) quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only display numeric IDs") noTrunc := cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Do not truncat...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdNetworkLs", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false", ...
// CmdNetworkLs handles Network List UI
[ "CmdNetworkLs", "handles", "Network", "List", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/network.go#L122-L172
22,632
docker/libnetwork
client/network.go
CmdNetworkInfo
func (cli *NetworkCli) CmdNetworkInfo(chain string, args ...string) error { cmd := cli.Subcmd(chain, "info", "NETWORK", "Displays detailed information on a network", false) cmd.Require(flag.Exact, 1) err := cmd.ParseFlags(args, true) if err != nil { return err } id, err := lookupNetworkID(cli, cmd.Arg(0)) if ...
go
func (cli *NetworkCli) CmdNetworkInfo(chain string, args ...string) error { cmd := cli.Subcmd(chain, "info", "NETWORK", "Displays detailed information on a network", false) cmd.Require(flag.Exact, 1) err := cmd.ParseFlags(args, true) if err != nil { return err } id, err := lookupNetworkID(cli, cmd.Arg(0)) if ...
[ "func", "(", "cli", "*", "NetworkCli", ")", "CmdNetworkInfo", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "cmd", ":=", "cli", ".", "Subcmd", "(", "chain", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "false",...
// CmdNetworkInfo handles Network Info UI
[ "CmdNetworkInfo", "handles", "Network", "Info", "UI" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/network.go#L175-L207
22,633
docker/libnetwork
client/network.go
lookupNetworkID
func lookupNetworkID(cli *NetworkCli, nameID string) (string, error) { obj, statusCode, err := readBody(cli.call("GET", "/networks?name="+nameID, nil, nil)) if err != nil { return "", err } if statusCode != http.StatusOK { return "", fmt.Errorf("name query failed for %s due to : statuscode(%d) %v", nameID, sta...
go
func lookupNetworkID(cli *NetworkCli, nameID string) (string, error) { obj, statusCode, err := readBody(cli.call("GET", "/networks?name="+nameID, nil, nil)) if err != nil { return "", err } if statusCode != http.StatusOK { return "", fmt.Errorf("name query failed for %s due to : statuscode(%d) %v", nameID, sta...
[ "func", "lookupNetworkID", "(", "cli", "*", "NetworkCli", ",", "nameID", "string", ")", "(", "string", ",", "error", ")", "{", "obj", ",", "statusCode", ",", "err", ":=", "readBody", "(", "cli", ".", "call", "(", "\"", "\"", ",", "\"", "\"", "+", "...
// Helper function to predict if a string is a name or id or partial-id // This provides a best-effort mechanism to identify an id with the help of GET Filter APIs // Being a UI, its most likely that name will be used by the user, which is used to lookup // the corresponding ID. If ID is not found, this function will a...
[ "Helper", "function", "to", "predict", "if", "a", "string", "is", "a", "name", "or", "id", "or", "partial", "-", "id", "This", "provides", "a", "best", "-", "effort", "mechanism", "to", "identify", "an", "id", "with", "the", "help", "of", "GET", "Filte...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/network.go#L215-L256
22,634
docker/libnetwork
drivers/ipvlan/ipvlan.go
Init
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { c := driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.GlobalScope, } d := &driver{ networks: networkTable{}, } d.initStore(config) return dc.RegisterDriver(ipvlanType, d, c) }
go
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { c := driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.GlobalScope, } d := &driver{ networks: networkTable{}, } d.initStore(config) return dc.RegisterDriver(ipvlanType, d, c) }
[ "func", "Init", "(", "dc", "driverapi", ".", "DriverCallback", ",", "config", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "c", ":=", "driverapi", ".", "Capability", "{", "DataScope", ":", "datastore", ".", "LocalScope", ",", "Con...
// Init initializes and registers the libnetwork ipvlan driver
[ "Init", "initializes", "and", "registers", "the", "libnetwork", "ipvlan", "driver" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan.go#L59-L70
22,635
docker/libnetwork
networkdb/networkdb.go
DefaultConfig
func DefaultConfig() *Config { hostname, _ := os.Hostname() return &Config{ NodeID: stringid.TruncateID(stringid.GenerateRandomID()), Hostname: hostname, BindAddr: "0.0.0.0", PacketBufferSize: 1400, StatsPrintPeriod: 5 * time.Minute, HealthPrintPeriod: 1 * time.Minute, rea...
go
func DefaultConfig() *Config { hostname, _ := os.Hostname() return &Config{ NodeID: stringid.TruncateID(stringid.GenerateRandomID()), Hostname: hostname, BindAddr: "0.0.0.0", PacketBufferSize: 1400, StatsPrintPeriod: 5 * time.Minute, HealthPrintPeriod: 1 * time.Minute, rea...
[ "func", "DefaultConfig", "(", ")", "*", "Config", "{", "hostname", ",", "_", ":=", "os", ".", "Hostname", "(", ")", "\n", "return", "&", "Config", "{", "NodeID", ":", "stringid", ".", "TruncateID", "(", "stringid", ".", "GenerateRandomID", "(", ")", ")...
// DefaultConfig returns a NetworkDB config with default values
[ "DefaultConfig", "returns", "a", "NetworkDB", "config", "with", "default", "values" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L225-L236
22,636
docker/libnetwork
networkdb/networkdb.go
New
func New(c *Config) (*NetworkDB, error) { // The garbage collection logic for entries leverage the presence of the network. // For this reason the expiration time of the network is put slightly higher than the entry expiration so that // there is at least 5 extra cycle to make sure that all the entries are properly ...
go
func New(c *Config) (*NetworkDB, error) { // The garbage collection logic for entries leverage the presence of the network. // For this reason the expiration time of the network is put slightly higher than the entry expiration so that // there is at least 5 extra cycle to make sure that all the entries are properly ...
[ "func", "New", "(", "c", "*", "Config", ")", "(", "*", "NetworkDB", ",", "error", ")", "{", "// The garbage collection logic for entries leverage the presence of the network.", "// For this reason the expiration time of the network is put slightly higher than the entry expiration so th...
// New creates a new instance of NetworkDB using the Config passed by // the caller.
[ "New", "creates", "a", "new", "instance", "of", "NetworkDB", "using", "the", "Config", "passed", "by", "the", "caller", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L240-L267
22,637
docker/libnetwork
networkdb/networkdb.go
Close
func (nDB *NetworkDB) Close() { if err := nDB.clusterLeave(); err != nil { logrus.Errorf("%v(%v) Could not close DB: %v", nDB.config.Hostname, nDB.config.NodeID, err) } //Avoid (*Broadcaster).run goroutine leak nDB.broadcaster.Close() }
go
func (nDB *NetworkDB) Close() { if err := nDB.clusterLeave(); err != nil { logrus.Errorf("%v(%v) Could not close DB: %v", nDB.config.Hostname, nDB.config.NodeID, err) } //Avoid (*Broadcaster).run goroutine leak nDB.broadcaster.Close() }
[ "func", "(", "nDB", "*", "NetworkDB", ")", "Close", "(", ")", "{", "if", "err", ":=", "nDB", ".", "clusterLeave", "(", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "Errorf", "(", "\"", "\"", ",", "nDB", ".", "config", ".", "Hostname", ",", ...
// Close destroys this NetworkDB instance by leave the cluster, // stopping timers, canceling goroutines etc.
[ "Close", "destroys", "this", "NetworkDB", "instance", "by", "leave", "the", "cluster", "stopping", "timers", "canceling", "goroutines", "etc", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L281-L288
22,638
docker/libnetwork
networkdb/networkdb.go
ClusterPeers
func (nDB *NetworkDB) ClusterPeers() []PeerInfo { nDB.RLock() defer nDB.RUnlock() peers := make([]PeerInfo, 0, len(nDB.nodes)) for _, node := range nDB.nodes { peers = append(peers, PeerInfo{ Name: node.Name, IP: node.Node.Addr.String(), }) } return peers }
go
func (nDB *NetworkDB) ClusterPeers() []PeerInfo { nDB.RLock() defer nDB.RUnlock() peers := make([]PeerInfo, 0, len(nDB.nodes)) for _, node := range nDB.nodes { peers = append(peers, PeerInfo{ Name: node.Name, IP: node.Node.Addr.String(), }) } return peers }
[ "func", "(", "nDB", "*", "NetworkDB", ")", "ClusterPeers", "(", ")", "[", "]", "PeerInfo", "{", "nDB", ".", "RLock", "(", ")", "\n", "defer", "nDB", ".", "RUnlock", "(", ")", "\n", "peers", ":=", "make", "(", "[", "]", "PeerInfo", ",", "0", ",", ...
// ClusterPeers returns all the gossip cluster peers.
[ "ClusterPeers", "returns", "all", "the", "gossip", "cluster", "peers", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L291-L302
22,639
docker/libnetwork
networkdb/networkdb.go
Peers
func (nDB *NetworkDB) Peers(nid string) []PeerInfo { nDB.RLock() defer nDB.RUnlock() peers := make([]PeerInfo, 0, len(nDB.networkNodes[nid])) for _, nodeName := range nDB.networkNodes[nid] { if node, ok := nDB.nodes[nodeName]; ok { peers = append(peers, PeerInfo{ Name: node.Name, IP: node.Addr.String...
go
func (nDB *NetworkDB) Peers(nid string) []PeerInfo { nDB.RLock() defer nDB.RUnlock() peers := make([]PeerInfo, 0, len(nDB.networkNodes[nid])) for _, nodeName := range nDB.networkNodes[nid] { if node, ok := nDB.nodes[nodeName]; ok { peers = append(peers, PeerInfo{ Name: node.Name, IP: node.Addr.String...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "Peers", "(", "nid", "string", ")", "[", "]", "PeerInfo", "{", "nDB", ".", "RLock", "(", ")", "\n", "defer", "nDB", ".", "RUnlock", "(", ")", "\n", "peers", ":=", "make", "(", "[", "]", "PeerInfo", ",", ...
// Peers returns the gossip peers for a given network.
[ "Peers", "returns", "the", "gossip", "peers", "for", "a", "given", "network", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L305-L322
22,640
docker/libnetwork
networkdb/networkdb.go
GetTableByNetwork
func (nDB *NetworkDB) GetTableByNetwork(tname, nid string) map[string]*TableElem { entries := make(map[string]*TableElem) nDB.indexes[byTable].WalkPrefix(fmt.Sprintf("/%s/%s", tname, nid), func(k string, v interface{}) bool { entry := v.(*entry) if entry.deleting { return false } key := k[strings.LastIndex...
go
func (nDB *NetworkDB) GetTableByNetwork(tname, nid string) map[string]*TableElem { entries := make(map[string]*TableElem) nDB.indexes[byTable].WalkPrefix(fmt.Sprintf("/%s/%s", tname, nid), func(k string, v interface{}) bool { entry := v.(*entry) if entry.deleting { return false } key := k[strings.LastIndex...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "GetTableByNetwork", "(", "tname", ",", "nid", "string", ")", "map", "[", "string", "]", "*", "TableElem", "{", "entries", ":=", "make", "(", "map", "[", "string", "]", "*", "TableElem", ")", "\n", "nDB", "....
// GetTableByNetwork walks the networkdb by the give table and network id and // returns a map of keys and values
[ "GetTableByNetwork", "walks", "the", "networkdb", "by", "the", "give", "table", "and", "network", "id", "and", "returns", "a", "map", "of", "keys", "and", "values" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L413-L425
22,641
docker/libnetwork
networkdb/networkdb.go
WalkTable
func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte, bool) bool) error { nDB.RLock() values := make(map[string]interface{}) nDB.indexes[byTable].WalkPrefix(fmt.Sprintf("/%s", tname), func(path string, v interface{}) bool { values[path] = v return false }) nDB.RUnlock() for k, v := ra...
go
func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte, bool) bool) error { nDB.RLock() values := make(map[string]interface{}) nDB.indexes[byTable].WalkPrefix(fmt.Sprintf("/%s", tname), func(path string, v interface{}) bool { values[path] = v return false }) nDB.RUnlock() for k, v := ra...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "WalkTable", "(", "tname", "string", ",", "fn", "func", "(", "string", ",", "string", ",", "[", "]", "byte", ",", "bool", ")", "bool", ")", "error", "{", "nDB", ".", "RLock", "(", ")", "\n", "values", ":...
// WalkTable walks a single table in NetworkDB and invokes the passed // function for each entry in the table passing the network, key, // value. The walk stops if the passed function returns a true.
[ "WalkTable", "walks", "a", "single", "table", "in", "NetworkDB", "and", "invokes", "the", "passed", "function", "for", "each", "entry", "in", "the", "table", "passing", "the", "network", "key", "value", ".", "The", "walk", "stops", "if", "the", "passed", "...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L569-L588
22,642
docker/libnetwork
networkdb/networkdb.go
JoinNetwork
func (nDB *NetworkDB) JoinNetwork(nid string) error { ltime := nDB.networkClock.Increment() nDB.Lock() nodeNetworks, ok := nDB.networks[nDB.config.NodeID] if !ok { nodeNetworks = make(map[string]*network) nDB.networks[nDB.config.NodeID] = nodeNetworks } n, ok := nodeNetworks[nid] var entries int if ok { ...
go
func (nDB *NetworkDB) JoinNetwork(nid string) error { ltime := nDB.networkClock.Increment() nDB.Lock() nodeNetworks, ok := nDB.networks[nDB.config.NodeID] if !ok { nodeNetworks = make(map[string]*network) nDB.networks[nDB.config.NodeID] = nodeNetworks } n, ok := nodeNetworks[nid] var entries int if ok { ...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "JoinNetwork", "(", "nid", "string", ")", "error", "{", "ltime", ":=", "nDB", ".", "networkClock", ".", "Increment", "(", ")", "\n\n", "nDB", ".", "Lock", "(", ")", "\n", "nodeNetworks", ",", "ok", ":=", "nD...
// JoinNetwork joins this node to a given network and propagates this // event across the cluster. This triggers this node joining the // sub-cluster of this network and participates in the network-scoped // gossip and bulk sync for this network.
[ "JoinNetwork", "joins", "this", "node", "to", "a", "given", "network", "and", "propagates", "this", "event", "across", "the", "cluster", ".", "This", "triggers", "this", "node", "joining", "the", "sub", "-", "cluster", "of", "this", "network", "and", "partic...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L594-L641
22,643
docker/libnetwork
networkdb/networkdb.go
LeaveNetwork
func (nDB *NetworkDB) LeaveNetwork(nid string) error { ltime := nDB.networkClock.Increment() if err := nDB.sendNetworkEvent(nid, NetworkEventTypeLeave, ltime); err != nil { return fmt.Errorf("failed to send leave network event for %s: %v", nid, err) } nDB.Lock() defer nDB.Unlock() // Remove myself from the li...
go
func (nDB *NetworkDB) LeaveNetwork(nid string) error { ltime := nDB.networkClock.Increment() if err := nDB.sendNetworkEvent(nid, NetworkEventTypeLeave, ltime); err != nil { return fmt.Errorf("failed to send leave network event for %s: %v", nid, err) } nDB.Lock() defer nDB.Unlock() // Remove myself from the li...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "LeaveNetwork", "(", "nid", "string", ")", "error", "{", "ltime", ":=", "nDB", ".", "networkClock", ".", "Increment", "(", ")", "\n", "if", "err", ":=", "nDB", ".", "sendNetworkEvent", "(", "nid", ",", "Networ...
// LeaveNetwork leaves this node from a given network and propagates // this event across the cluster. This triggers this node leaving the // sub-cluster of this network and as a result will no longer // participate in the network-scoped gossip and bulk sync for this // network. Also remove all the table entries for th...
[ "LeaveNetwork", "leaves", "this", "node", "from", "a", "given", "network", "and", "propagates", "this", "event", "across", "the", "cluster", ".", "This", "triggers", "this", "node", "leaving", "the", "sub", "-", "cluster", "of", "this", "network", "and", "as...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L649-L679
22,644
docker/libnetwork
networkdb/networkdb.go
addNetworkNode
func (nDB *NetworkDB) addNetworkNode(nid string, nodeName string) { nodes := nDB.networkNodes[nid] for _, node := range nodes { if node == nodeName { return } } nDB.networkNodes[nid] = append(nDB.networkNodes[nid], nodeName) }
go
func (nDB *NetworkDB) addNetworkNode(nid string, nodeName string) { nodes := nDB.networkNodes[nid] for _, node := range nodes { if node == nodeName { return } } nDB.networkNodes[nid] = append(nDB.networkNodes[nid], nodeName) }
[ "func", "(", "nDB", "*", "NetworkDB", ")", "addNetworkNode", "(", "nid", "string", ",", "nodeName", "string", ")", "{", "nodes", ":=", "nDB", ".", "networkNodes", "[", "nid", "]", "\n", "for", "_", ",", "node", ":=", "range", "nodes", "{", "if", "nod...
// addNetworkNode adds the node to the list of nodes which participate // in the passed network only if it is not already present. Caller // should hold the NetworkDB lock while calling this
[ "addNetworkNode", "adds", "the", "node", "to", "the", "list", "of", "nodes", "which", "participate", "in", "the", "passed", "network", "only", "if", "it", "is", "not", "already", "present", ".", "Caller", "should", "hold", "the", "NetworkDB", "lock", "while"...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L684-L693
22,645
docker/libnetwork
networkdb/networkdb.go
deleteNetworkNode
func (nDB *NetworkDB) deleteNetworkNode(nid string, nodeName string) { nodes, ok := nDB.networkNodes[nid] if !ok || len(nodes) == 0 { return } newNodes := make([]string, 0, len(nodes)-1) for _, name := range nodes { if name == nodeName { continue } newNodes = append(newNodes, name) } nDB.networkNodes[...
go
func (nDB *NetworkDB) deleteNetworkNode(nid string, nodeName string) { nodes, ok := nDB.networkNodes[nid] if !ok || len(nodes) == 0 { return } newNodes := make([]string, 0, len(nodes)-1) for _, name := range nodes { if name == nodeName { continue } newNodes = append(newNodes, name) } nDB.networkNodes[...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "deleteNetworkNode", "(", "nid", "string", ",", "nodeName", "string", ")", "{", "nodes", ",", "ok", ":=", "nDB", ".", "networkNodes", "[", "nid", "]", "\n", "if", "!", "ok", "||", "len", "(", "nodes", ")", ...
// Deletes the node from the list of nodes which participate in the // passed network. Caller should hold the NetworkDB lock while calling // this
[ "Deletes", "the", "node", "from", "the", "list", "of", "nodes", "which", "participate", "in", "the", "passed", "network", ".", "Caller", "should", "hold", "the", "NetworkDB", "lock", "while", "calling", "this" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L698-L711
22,646
docker/libnetwork
networkdb/networkdb.go
findCommonNetworks
func (nDB *NetworkDB) findCommonNetworks(nodeName string) []string { nDB.RLock() defer nDB.RUnlock() var networks []string for nid := range nDB.networks[nDB.config.NodeID] { if n, ok := nDB.networks[nodeName][nid]; ok { if !n.leaving { networks = append(networks, nid) } } } return networks }
go
func (nDB *NetworkDB) findCommonNetworks(nodeName string) []string { nDB.RLock() defer nDB.RUnlock() var networks []string for nid := range nDB.networks[nDB.config.NodeID] { if n, ok := nDB.networks[nodeName][nid]; ok { if !n.leaving { networks = append(networks, nid) } } } return networks }
[ "func", "(", "nDB", "*", "NetworkDB", ")", "findCommonNetworks", "(", "nodeName", "string", ")", "[", "]", "string", "{", "nDB", ".", "RLock", "(", ")", "\n", "defer", "nDB", ".", "RUnlock", "(", ")", "\n\n", "var", "networks", "[", "]", "string", "\...
// findCommonnetworks find the networks that both this node and the // passed node have joined.
[ "findCommonnetworks", "find", "the", "networks", "that", "both", "this", "node", "and", "the", "passed", "node", "have", "joined", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/networkdb.go#L715-L729
22,647
docker/libnetwork
networkdb/cluster.go
SetKey
func (nDB *NetworkDB) SetKey(key []byte) { logrus.Debugf("Adding key %.5s", hex.EncodeToString(key)) nDB.Lock() defer nDB.Unlock() for _, dbKey := range nDB.config.Keys { if bytes.Equal(key, dbKey) { return } } nDB.config.Keys = append(nDB.config.Keys, key) if nDB.keyring != nil { nDB.keyring.AddKey(key...
go
func (nDB *NetworkDB) SetKey(key []byte) { logrus.Debugf("Adding key %.5s", hex.EncodeToString(key)) nDB.Lock() defer nDB.Unlock() for _, dbKey := range nDB.config.Keys { if bytes.Equal(key, dbKey) { return } } nDB.config.Keys = append(nDB.config.Keys, key) if nDB.keyring != nil { nDB.keyring.AddKey(key...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "SetKey", "(", "key", "[", "]", "byte", ")", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "hex", ".", "EncodeToString", "(", "key", ")", ")", "\n", "nDB", ".", "Lock", "(", ")", "\n", "defer", "...
// SetKey adds a new key to the key ring
[ "SetKey", "adds", "a", "new", "key", "to", "the", "key", "ring" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/cluster.go#L57-L70
22,648
docker/libnetwork
networkdb/cluster.go
SetPrimaryKey
func (nDB *NetworkDB) SetPrimaryKey(key []byte) { logrus.Debugf("Primary Key %.5s", hex.EncodeToString(key)) nDB.RLock() defer nDB.RUnlock() for _, dbKey := range nDB.config.Keys { if bytes.Equal(key, dbKey) { if nDB.keyring != nil { nDB.keyring.UseKey(dbKey) } break } } }
go
func (nDB *NetworkDB) SetPrimaryKey(key []byte) { logrus.Debugf("Primary Key %.5s", hex.EncodeToString(key)) nDB.RLock() defer nDB.RUnlock() for _, dbKey := range nDB.config.Keys { if bytes.Equal(key, dbKey) { if nDB.keyring != nil { nDB.keyring.UseKey(dbKey) } break } } }
[ "func", "(", "nDB", "*", "NetworkDB", ")", "SetPrimaryKey", "(", "key", "[", "]", "byte", ")", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "hex", ".", "EncodeToString", "(", "key", ")", ")", "\n", "nDB", ".", "RLock", "(", ")", "\n", "def...
// SetPrimaryKey sets the given key as the primary key. This should have // been added apriori through SetKey
[ "SetPrimaryKey", "sets", "the", "given", "key", "as", "the", "primary", "key", ".", "This", "should", "have", "been", "added", "apriori", "through", "SetKey" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/cluster.go#L74-L86
22,649
docker/libnetwork
networkdb/cluster.go
RemoveKey
func (nDB *NetworkDB) RemoveKey(key []byte) { logrus.Debugf("Remove Key %.5s", hex.EncodeToString(key)) nDB.Lock() defer nDB.Unlock() for i, dbKey := range nDB.config.Keys { if bytes.Equal(key, dbKey) { nDB.config.Keys = append(nDB.config.Keys[:i], nDB.config.Keys[i+1:]...) if nDB.keyring != nil { nDB.k...
go
func (nDB *NetworkDB) RemoveKey(key []byte) { logrus.Debugf("Remove Key %.5s", hex.EncodeToString(key)) nDB.Lock() defer nDB.Unlock() for i, dbKey := range nDB.config.Keys { if bytes.Equal(key, dbKey) { nDB.config.Keys = append(nDB.config.Keys[:i], nDB.config.Keys[i+1:]...) if nDB.keyring != nil { nDB.k...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "RemoveKey", "(", "key", "[", "]", "byte", ")", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ",", "hex", ".", "EncodeToString", "(", "key", ")", ")", "\n", "nDB", ".", "Lock", "(", ")", "\n", "defer", ...
// RemoveKey removes a key from the key ring. The key being removed // can't be the primary key
[ "RemoveKey", "removes", "a", "key", "from", "the", "key", "ring", ".", "The", "key", "being", "removed", "can", "t", "be", "the", "primary", "key" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/cluster.go#L90-L103
22,650
docker/libnetwork
networkdb/cluster.go
mRandomNodes
func (nDB *NetworkDB) mRandomNodes(m int, nodes []string) []string { n := len(nodes) mNodes := make([]string, 0, m) OUTER: // Probe up to 3*n times, with large n this is not necessary // since k << n, but with small n we want search to be // exhaustive for i := 0; i < 3*n && len(mNodes) < m; i++ { // Get random...
go
func (nDB *NetworkDB) mRandomNodes(m int, nodes []string) []string { n := len(nodes) mNodes := make([]string, 0, m) OUTER: // Probe up to 3*n times, with large n this is not necessary // since k << n, but with small n we want search to be // exhaustive for i := 0; i < 3*n && len(mNodes) < m; i++ { // Get random...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "mRandomNodes", "(", "m", "int", ",", "nodes", "[", "]", "string", ")", "[", "]", "string", "{", "n", ":=", "len", "(", "nodes", ")", "\n", "mNodes", ":=", "make", "(", "[", "]", "string", ",", "0", ",...
// mRandomNodes is used to select up to m random nodes. It is possible // that less than m nodes are returned.
[ "mRandomNodes", "is", "used", "to", "select", "up", "to", "m", "random", "nodes", ".", "It", "is", "possible", "that", "less", "than", "m", "nodes", "are", "returned", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/cluster.go#L733-L761
22,651
docker/libnetwork
drvregistry/drvregistry.go
New
func New(lDs, gDs interface{}, dfn DriverNotifyFunc, ifn IPAMNotifyFunc, pg plugingetter.PluginGetter) (*DrvRegistry, error) { r := &DrvRegistry{ drivers: make(driverTable), ipamDrivers: make(ipamTable), dfn: dfn, ifn: ifn, pluginGetter: pg, } return r, nil }
go
func New(lDs, gDs interface{}, dfn DriverNotifyFunc, ifn IPAMNotifyFunc, pg plugingetter.PluginGetter) (*DrvRegistry, error) { r := &DrvRegistry{ drivers: make(driverTable), ipamDrivers: make(ipamTable), dfn: dfn, ifn: ifn, pluginGetter: pg, } return r, nil }
[ "func", "New", "(", "lDs", ",", "gDs", "interface", "{", "}", ",", "dfn", "DriverNotifyFunc", ",", "ifn", "IPAMNotifyFunc", ",", "pg", "plugingetter", ".", "PluginGetter", ")", "(", "*", "DrvRegistry", ",", "error", ")", "{", "r", ":=", "&", "DrvRegistry...
// New returns a new driver registry handle.
[ "New", "returns", "a", "new", "driver", "registry", "handle", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L58-L68
22,652
docker/libnetwork
drvregistry/drvregistry.go
AddDriver
func (r *DrvRegistry) AddDriver(ntype string, fn InitFunc, config map[string]interface{}) error { return fn(r, config) }
go
func (r *DrvRegistry) AddDriver(ntype string, fn InitFunc, config map[string]interface{}) error { return fn(r, config) }
[ "func", "(", "r", "*", "DrvRegistry", ")", "AddDriver", "(", "ntype", "string", ",", "fn", "InitFunc", ",", "config", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "return", "fn", "(", "r", ",", "config", ")", "\n", "}" ]
// AddDriver adds a network driver to the registry.
[ "AddDriver", "adds", "a", "network", "driver", "to", "the", "registry", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L71-L73
22,653
docker/libnetwork
drvregistry/drvregistry.go
WalkIPAMs
func (r *DrvRegistry) WalkIPAMs(ifn IPAMWalkFunc) { type ipamVal struct { name string data *ipamData } r.Lock() ivl := make([]ipamVal, 0, len(r.ipamDrivers)) for k, v := range r.ipamDrivers { ivl = append(ivl, ipamVal{name: k, data: v}) } r.Unlock() for _, iv := range ivl { if ifn(iv.name, iv.data.dri...
go
func (r *DrvRegistry) WalkIPAMs(ifn IPAMWalkFunc) { type ipamVal struct { name string data *ipamData } r.Lock() ivl := make([]ipamVal, 0, len(r.ipamDrivers)) for k, v := range r.ipamDrivers { ivl = append(ivl, ipamVal{name: k, data: v}) } r.Unlock() for _, iv := range ivl { if ifn(iv.name, iv.data.dri...
[ "func", "(", "r", "*", "DrvRegistry", ")", "WalkIPAMs", "(", "ifn", "IPAMWalkFunc", ")", "{", "type", "ipamVal", "struct", "{", "name", "string", "\n", "data", "*", "ipamData", "\n", "}", "\n\n", "r", ".", "Lock", "(", ")", "\n", "ivl", ":=", "make",...
// WalkIPAMs walks the IPAM drivers registered in the registry and invokes the passed walk function and each one of them.
[ "WalkIPAMs", "walks", "the", "IPAM", "drivers", "registered", "in", "the", "registry", "and", "invokes", "the", "passed", "walk", "function", "and", "each", "one", "of", "them", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L76-L94
22,654
docker/libnetwork
drvregistry/drvregistry.go
WalkDrivers
func (r *DrvRegistry) WalkDrivers(dfn DriverWalkFunc) { type driverVal struct { name string data *driverData } r.Lock() dvl := make([]driverVal, 0, len(r.drivers)) for k, v := range r.drivers { dvl = append(dvl, driverVal{name: k, data: v}) } r.Unlock() for _, dv := range dvl { if dfn(dv.name, dv.data...
go
func (r *DrvRegistry) WalkDrivers(dfn DriverWalkFunc) { type driverVal struct { name string data *driverData } r.Lock() dvl := make([]driverVal, 0, len(r.drivers)) for k, v := range r.drivers { dvl = append(dvl, driverVal{name: k, data: v}) } r.Unlock() for _, dv := range dvl { if dfn(dv.name, dv.data...
[ "func", "(", "r", "*", "DrvRegistry", ")", "WalkDrivers", "(", "dfn", "DriverWalkFunc", ")", "{", "type", "driverVal", "struct", "{", "name", "string", "\n", "data", "*", "driverData", "\n", "}", "\n\n", "r", ".", "Lock", "(", ")", "\n", "dvl", ":=", ...
// WalkDrivers walks the network drivers registered in the registry and invokes the passed walk function and each one of them.
[ "WalkDrivers", "walks", "the", "network", "drivers", "registered", "in", "the", "registry", "and", "invokes", "the", "passed", "walk", "function", "and", "each", "one", "of", "them", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L97-L115
22,655
docker/libnetwork
drvregistry/drvregistry.go
Driver
func (r *DrvRegistry) Driver(name string) (driverapi.Driver, *driverapi.Capability) { r.Lock() defer r.Unlock() d, ok := r.drivers[name] if !ok { return nil, nil } return d.driver, &d.capability }
go
func (r *DrvRegistry) Driver(name string) (driverapi.Driver, *driverapi.Capability) { r.Lock() defer r.Unlock() d, ok := r.drivers[name] if !ok { return nil, nil } return d.driver, &d.capability }
[ "func", "(", "r", "*", "DrvRegistry", ")", "Driver", "(", "name", "string", ")", "(", "driverapi", ".", "Driver", ",", "*", "driverapi", ".", "Capability", ")", "{", "r", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "Unlock", "(", ")", "\n\n", ...
// Driver returns the actual network driver instance and its capability which registered with the passed name.
[ "Driver", "returns", "the", "actual", "network", "driver", "instance", "and", "its", "capability", "which", "registered", "with", "the", "passed", "name", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L118-L128
22,656
docker/libnetwork
drvregistry/drvregistry.go
IPAM
func (r *DrvRegistry) IPAM(name string) (ipamapi.Ipam, *ipamapi.Capability) { r.Lock() defer r.Unlock() i, ok := r.ipamDrivers[name] if !ok { return nil, nil } return i.driver, i.capability }
go
func (r *DrvRegistry) IPAM(name string) (ipamapi.Ipam, *ipamapi.Capability) { r.Lock() defer r.Unlock() i, ok := r.ipamDrivers[name] if !ok { return nil, nil } return i.driver, i.capability }
[ "func", "(", "r", "*", "DrvRegistry", ")", "IPAM", "(", "name", "string", ")", "(", "ipamapi", ".", "Ipam", ",", "*", "ipamapi", ".", "Capability", ")", "{", "r", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "Unlock", "(", ")", "\n\n", "i", ...
// IPAM returns the actual IPAM driver instance and its capability which registered with the passed name.
[ "IPAM", "returns", "the", "actual", "IPAM", "driver", "instance", "and", "its", "capability", "which", "registered", "with", "the", "passed", "name", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L131-L141
22,657
docker/libnetwork
drvregistry/drvregistry.go
IPAMDefaultAddressSpaces
func (r *DrvRegistry) IPAMDefaultAddressSpaces(name string) (string, string, error) { r.Lock() defer r.Unlock() i, ok := r.ipamDrivers[name] if !ok { return "", "", fmt.Errorf("ipam %s not found", name) } return i.defaultLocalAddressSpace, i.defaultGlobalAddressSpace, nil }
go
func (r *DrvRegistry) IPAMDefaultAddressSpaces(name string) (string, string, error) { r.Lock() defer r.Unlock() i, ok := r.ipamDrivers[name] if !ok { return "", "", fmt.Errorf("ipam %s not found", name) } return i.defaultLocalAddressSpace, i.defaultGlobalAddressSpace, nil }
[ "func", "(", "r", "*", "DrvRegistry", ")", "IPAMDefaultAddressSpaces", "(", "name", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "r", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "Unlock", "(", ")", "\n\n", "i", ",", "ok"...
// IPAMDefaultAddressSpaces returns the default address space strings for the passed IPAM driver name.
[ "IPAMDefaultAddressSpaces", "returns", "the", "default", "address", "space", "strings", "for", "the", "passed", "IPAM", "driver", "name", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L144-L154
22,658
docker/libnetwork
drvregistry/drvregistry.go
RegisterDriver
func (r *DrvRegistry) RegisterDriver(ntype string, driver driverapi.Driver, capability driverapi.Capability) error { if strings.TrimSpace(ntype) == "" { return errors.New("network type string cannot be empty") } r.Lock() dd, ok := r.drivers[ntype] r.Unlock() if ok && dd.driver.IsBuiltIn() { return driverapi...
go
func (r *DrvRegistry) RegisterDriver(ntype string, driver driverapi.Driver, capability driverapi.Capability) error { if strings.TrimSpace(ntype) == "" { return errors.New("network type string cannot be empty") } r.Lock() dd, ok := r.drivers[ntype] r.Unlock() if ok && dd.driver.IsBuiltIn() { return driverapi...
[ "func", "(", "r", "*", "DrvRegistry", ")", "RegisterDriver", "(", "ntype", "string", ",", "driver", "driverapi", ".", "Driver", ",", "capability", "driverapi", ".", "Capability", ")", "error", "{", "if", "strings", ".", "TrimSpace", "(", "ntype", ")", "=="...
// RegisterDriver registers the network driver when it gets discovered.
[ "RegisterDriver", "registers", "the", "network", "driver", "when", "it", "gets", "discovered", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L162-L188
22,659
docker/libnetwork
drvregistry/drvregistry.go
RegisterIpamDriver
func (r *DrvRegistry) RegisterIpamDriver(name string, driver ipamapi.Ipam) error { return r.registerIpamDriver(name, driver, &ipamapi.Capability{}) }
go
func (r *DrvRegistry) RegisterIpamDriver(name string, driver ipamapi.Ipam) error { return r.registerIpamDriver(name, driver, &ipamapi.Capability{}) }
[ "func", "(", "r", "*", "DrvRegistry", ")", "RegisterIpamDriver", "(", "name", "string", ",", "driver", "ipamapi", ".", "Ipam", ")", "error", "{", "return", "r", ".", "registerIpamDriver", "(", "name", ",", "driver", ",", "&", "ipamapi", ".", "Capability", ...
// RegisterIpamDriver registers the IPAM driver discovered with default capabilities.
[ "RegisterIpamDriver", "registers", "the", "IPAM", "driver", "discovered", "with", "default", "capabilities", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L221-L223
22,660
docker/libnetwork
drvregistry/drvregistry.go
RegisterIpamDriverWithCapabilities
func (r *DrvRegistry) RegisterIpamDriverWithCapabilities(name string, driver ipamapi.Ipam, caps *ipamapi.Capability) error { return r.registerIpamDriver(name, driver, caps) }
go
func (r *DrvRegistry) RegisterIpamDriverWithCapabilities(name string, driver ipamapi.Ipam, caps *ipamapi.Capability) error { return r.registerIpamDriver(name, driver, caps) }
[ "func", "(", "r", "*", "DrvRegistry", ")", "RegisterIpamDriverWithCapabilities", "(", "name", "string", ",", "driver", "ipamapi", ".", "Ipam", ",", "caps", "*", "ipamapi", ".", "Capability", ")", "error", "{", "return", "r", ".", "registerIpamDriver", "(", "...
// RegisterIpamDriverWithCapabilities registers the IPAM driver discovered with specified capabilities.
[ "RegisterIpamDriverWithCapabilities", "registers", "the", "IPAM", "driver", "discovered", "with", "specified", "capabilities", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drvregistry/drvregistry.go#L226-L228
22,661
docker/libnetwork
drivers/bridge/netlink_deprecated_linux.go
getIfSocket
func getIfSocket() (fd int, err error) { for _, socket := range []int{ syscall.AF_INET, syscall.AF_PACKET, syscall.AF_INET6, } { if fd, err = syscall.Socket(socket, syscall.SOCK_DGRAM, 0); err == nil { break } } if err == nil { return fd, nil } return -1, err }
go
func getIfSocket() (fd int, err error) { for _, socket := range []int{ syscall.AF_INET, syscall.AF_PACKET, syscall.AF_INET6, } { if fd, err = syscall.Socket(socket, syscall.SOCK_DGRAM, 0); err == nil { break } } if err == nil { return fd, nil } return -1, err }
[ "func", "getIfSocket", "(", ")", "(", "fd", "int", ",", "err", "error", ")", "{", "for", "_", ",", "socket", ":=", "range", "[", "]", "int", "{", "syscall", ".", "AF_INET", ",", "syscall", ".", "AF_PACKET", ",", "syscall", ".", "AF_INET6", ",", "}"...
// THIS CODE DOES NOT COMMUNICATE WITH KERNEL VIA RTNETLINK INTERFACE // IT IS HERE FOR BACKWARDS COMPATIBILITY WITH OLDER LINUX KERNELS // WHICH SHIP WITH OLDER NOT ENTIRELY FUNCTIONAL VERSION OF NETLINK
[ "THIS", "CODE", "DOES", "NOT", "COMMUNICATE", "WITH", "KERNEL", "VIA", "RTNETLINK", "INTERFACE", "IT", "IS", "HERE", "FOR", "BACKWARDS", "COMPATIBILITY", "WITH", "OLDER", "LINUX", "KERNELS", "WHICH", "SHIP", "WITH", "OLDER", "NOT", "ENTIRELY", "FUNCTIONAL", "VER...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/netlink_deprecated_linux.go#L35-L49
22,662
docker/libnetwork
drivers/bridge/netlink_deprecated_linux.go
ioctlAddToBridge
func ioctlAddToBridge(iface, master *net.Interface) error { return ifIoctBridge(iface, master, ioctlBrAddIf) }
go
func ioctlAddToBridge(iface, master *net.Interface) error { return ifIoctBridge(iface, master, ioctlBrAddIf) }
[ "func", "ioctlAddToBridge", "(", "iface", ",", "master", "*", "net", ".", "Interface", ")", "error", "{", "return", "ifIoctBridge", "(", "iface", ",", "master", ",", "ioctlBrAddIf", ")", "\n", "}" ]
// Add a slave to a bridge device. This is more backward-compatible than // netlink.NetworkSetMaster and works on RHEL 6.
[ "Add", "a", "slave", "to", "a", "bridge", "device", ".", "This", "is", "more", "backward", "-", "compatible", "than", "netlink", ".", "NetworkSetMaster", "and", "works", "on", "RHEL", "6", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/netlink_deprecated_linux.go#L75-L77
22,663
docker/libnetwork
sandbox.go
OptionHostname
func OptionHostname(name string) SandboxOption { return func(sb *sandbox) { sb.config.hostName = name } }
go
func OptionHostname(name string) SandboxOption { return func(sb *sandbox) { sb.config.hostName = name } }
[ "func", "OptionHostname", "(", "name", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "hostName", "=", "name", "\n", "}", "\n", "}" ]
// OptionHostname function returns an option setter for hostname option to // be passed to NewSandbox method.
[ "OptionHostname", "function", "returns", "an", "option", "setter", "for", "hostname", "option", "to", "be", "passed", "to", "NewSandbox", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1038-L1042
22,664
docker/libnetwork
sandbox.go
OptionDomainname
func OptionDomainname(name string) SandboxOption { return func(sb *sandbox) { sb.config.domainName = name } }
go
func OptionDomainname(name string) SandboxOption { return func(sb *sandbox) { sb.config.domainName = name } }
[ "func", "OptionDomainname", "(", "name", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "domainName", "=", "name", "\n", "}", "\n", "}" ]
// OptionDomainname function returns an option setter for domainname option to // be passed to NewSandbox method.
[ "OptionDomainname", "function", "returns", "an", "option", "setter", "for", "domainname", "option", "to", "be", "passed", "to", "NewSandbox", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1046-L1050
22,665
docker/libnetwork
sandbox.go
OptionHostsPath
func OptionHostsPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.hostsPath = path } }
go
func OptionHostsPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.hostsPath = path } }
[ "func", "OptionHostsPath", "(", "path", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "hostsPath", "=", "path", "\n", "}", "\n", "}" ]
// OptionHostsPath function returns an option setter for hostspath option to // be passed to NewSandbox method.
[ "OptionHostsPath", "function", "returns", "an", "option", "setter", "for", "hostspath", "option", "to", "be", "passed", "to", "NewSandbox", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1054-L1058
22,666
docker/libnetwork
sandbox.go
OptionOriginHostsPath
func OptionOriginHostsPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.originHostsPath = path } }
go
func OptionOriginHostsPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.originHostsPath = path } }
[ "func", "OptionOriginHostsPath", "(", "path", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "originHostsPath", "=", "path", "\n", "}", "\n", "}" ]
// OptionOriginHostsPath function returns an option setter for origin hosts file path // to be passed to NewSandbox method.
[ "OptionOriginHostsPath", "function", "returns", "an", "option", "setter", "for", "origin", "hosts", "file", "path", "to", "be", "passed", "to", "NewSandbox", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1062-L1066
22,667
docker/libnetwork
sandbox.go
OptionParentUpdate
func OptionParentUpdate(cid string, name, ip string) SandboxOption { return func(sb *sandbox) { sb.config.parentUpdates = append(sb.config.parentUpdates, parentUpdate{cid: cid, name: name, ip: ip}) } }
go
func OptionParentUpdate(cid string, name, ip string) SandboxOption { return func(sb *sandbox) { sb.config.parentUpdates = append(sb.config.parentUpdates, parentUpdate{cid: cid, name: name, ip: ip}) } }
[ "func", "OptionParentUpdate", "(", "cid", "string", ",", "name", ",", "ip", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "parentUpdates", "=", "append", "(", "sb", ".", "config", ...
// OptionParentUpdate function returns an option setter for parent container // which needs to update the IP address for the linked container.
[ "OptionParentUpdate", "function", "returns", "an", "option", "setter", "for", "parent", "container", "which", "needs", "to", "update", "the", "IP", "address", "for", "the", "linked", "container", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1078-L1082
22,668
docker/libnetwork
sandbox.go
OptionResolvConfPath
func OptionResolvConfPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.resolvConfPath = path } }
go
func OptionResolvConfPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.resolvConfPath = path } }
[ "func", "OptionResolvConfPath", "(", "path", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "resolvConfPath", "=", "path", "\n", "}", "\n", "}" ]
// OptionResolvConfPath function returns an option setter for resolvconfpath option to // be passed to net container methods.
[ "OptionResolvConfPath", "function", "returns", "an", "option", "setter", "for", "resolvconfpath", "option", "to", "be", "passed", "to", "net", "container", "methods", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1086-L1090
22,669
docker/libnetwork
sandbox.go
OptionOriginResolvConfPath
func OptionOriginResolvConfPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.originResolvConfPath = path } }
go
func OptionOriginResolvConfPath(path string) SandboxOption { return func(sb *sandbox) { sb.config.originResolvConfPath = path } }
[ "func", "OptionOriginResolvConfPath", "(", "path", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "originResolvConfPath", "=", "path", "\n", "}", "\n", "}" ]
// OptionOriginResolvConfPath function returns an option setter to set the path to the // origin resolv.conf file to be passed to net container methods.
[ "OptionOriginResolvConfPath", "function", "returns", "an", "option", "setter", "to", "set", "the", "path", "to", "the", "origin", "resolv", ".", "conf", "file", "to", "be", "passed", "to", "net", "container", "methods", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1094-L1098
22,670
docker/libnetwork
sandbox.go
OptionDNS
func OptionDNS(dns string) SandboxOption { return func(sb *sandbox) { sb.config.dnsList = append(sb.config.dnsList, dns) } }
go
func OptionDNS(dns string) SandboxOption { return func(sb *sandbox) { sb.config.dnsList = append(sb.config.dnsList, dns) } }
[ "func", "OptionDNS", "(", "dns", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "dnsList", "=", "append", "(", "sb", ".", "config", ".", "dnsList", ",", "dns", ")", "\n", "}", "...
// OptionDNS function returns an option setter for dns entry option to // be passed to container Create method.
[ "OptionDNS", "function", "returns", "an", "option", "setter", "for", "dns", "entry", "option", "to", "be", "passed", "to", "container", "Create", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1102-L1106
22,671
docker/libnetwork
sandbox.go
OptionDNSSearch
func OptionDNSSearch(search string) SandboxOption { return func(sb *sandbox) { sb.config.dnsSearchList = append(sb.config.dnsSearchList, search) } }
go
func OptionDNSSearch(search string) SandboxOption { return func(sb *sandbox) { sb.config.dnsSearchList = append(sb.config.dnsSearchList, search) } }
[ "func", "OptionDNSSearch", "(", "search", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "dnsSearchList", "=", "append", "(", "sb", ".", "config", ".", "dnsSearchList", ",", "search", ...
// OptionDNSSearch function returns an option setter for dns search entry option to // be passed to container Create method.
[ "OptionDNSSearch", "function", "returns", "an", "option", "setter", "for", "dns", "search", "entry", "option", "to", "be", "passed", "to", "container", "Create", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1110-L1114
22,672
docker/libnetwork
sandbox.go
OptionDNSOptions
func OptionDNSOptions(options string) SandboxOption { return func(sb *sandbox) { sb.config.dnsOptionsList = append(sb.config.dnsOptionsList, options) } }
go
func OptionDNSOptions(options string) SandboxOption { return func(sb *sandbox) { sb.config.dnsOptionsList = append(sb.config.dnsOptionsList, options) } }
[ "func", "OptionDNSOptions", "(", "options", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "config", ".", "dnsOptionsList", "=", "append", "(", "sb", ".", "config", ".", "dnsOptionsList", ",", "option...
// OptionDNSOptions function returns an option setter for dns options entry option to // be passed to container Create method.
[ "OptionDNSOptions", "function", "returns", "an", "option", "setter", "for", "dns", "options", "entry", "option", "to", "be", "passed", "to", "container", "Create", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1118-L1122
22,673
docker/libnetwork
sandbox.go
OptionGeneric
func OptionGeneric(generic map[string]interface{}) SandboxOption { return func(sb *sandbox) { if sb.config.generic == nil { sb.config.generic = make(map[string]interface{}, len(generic)) } for k, v := range generic { sb.config.generic[k] = v } } }
go
func OptionGeneric(generic map[string]interface{}) SandboxOption { return func(sb *sandbox) { if sb.config.generic == nil { sb.config.generic = make(map[string]interface{}, len(generic)) } for k, v := range generic { sb.config.generic[k] = v } } }
[ "func", "OptionGeneric", "(", "generic", "map", "[", "string", "]", "interface", "{", "}", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "if", "sb", ".", "config", ".", "generic", "==", "nil", "{", "sb", ".", "conf...
// OptionGeneric function returns an option setter for Generic configuration // that is not managed by libNetwork but can be used by the Drivers during the call to // net container creation method. Container Labels are a good example.
[ "OptionGeneric", "function", "returns", "an", "option", "setter", "for", "Generic", "configuration", "that", "is", "not", "managed", "by", "libNetwork", "but", "can", "be", "used", "by", "the", "Drivers", "during", "the", "call", "to", "net", "container", "cre...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1143-L1152
22,674
docker/libnetwork
sandbox.go
OptionExposedPorts
func OptionExposedPorts(exposedPorts []types.TransportPort) SandboxOption { return func(sb *sandbox) { if sb.config.generic == nil { sb.config.generic = make(map[string]interface{}) } // Defensive copy eps := make([]types.TransportPort, len(exposedPorts)) copy(eps, exposedPorts) // Store endpoint label ...
go
func OptionExposedPorts(exposedPorts []types.TransportPort) SandboxOption { return func(sb *sandbox) { if sb.config.generic == nil { sb.config.generic = make(map[string]interface{}) } // Defensive copy eps := make([]types.TransportPort, len(exposedPorts)) copy(eps, exposedPorts) // Store endpoint label ...
[ "func", "OptionExposedPorts", "(", "exposedPorts", "[", "]", "types", ".", "TransportPort", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "if", "sb", ".", "config", ".", "generic", "==", "nil", "{", "sb", ".", "config"...
// OptionExposedPorts function returns an option setter for the container exposed // ports option to be passed to container Create method.
[ "OptionExposedPorts", "function", "returns", "an", "option", "setter", "for", "the", "container", "exposed", "ports", "option", "to", "be", "passed", "to", "container", "Create", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1156-L1168
22,675
docker/libnetwork
sandbox.go
OptionPortMapping
func OptionPortMapping(portBindings []types.PortBinding) SandboxOption { return func(sb *sandbox) { if sb.config.generic == nil { sb.config.generic = make(map[string]interface{}) } // Store a copy of the bindings as generic data to pass to the driver pbs := make([]types.PortBinding, len(portBindings)) cop...
go
func OptionPortMapping(portBindings []types.PortBinding) SandboxOption { return func(sb *sandbox) { if sb.config.generic == nil { sb.config.generic = make(map[string]interface{}) } // Store a copy of the bindings as generic data to pass to the driver pbs := make([]types.PortBinding, len(portBindings)) cop...
[ "func", "OptionPortMapping", "(", "portBindings", "[", "]", "types", ".", "PortBinding", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "if", "sb", ".", "config", ".", "generic", "==", "nil", "{", "sb", ".", "config", ...
// OptionPortMapping function returns an option setter for the mapping // ports option to be passed to container Create method.
[ "OptionPortMapping", "function", "returns", "an", "option", "setter", "for", "the", "mapping", "ports", "option", "to", "be", "passed", "to", "container", "Create", "method", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1172-L1182
22,676
docker/libnetwork
sandbox.go
OptionIngress
func OptionIngress() SandboxOption { return func(sb *sandbox) { sb.ingress = true sb.oslTypes = append(sb.oslTypes, osl.SandboxTypeIngress) } }
go
func OptionIngress() SandboxOption { return func(sb *sandbox) { sb.ingress = true sb.oslTypes = append(sb.oslTypes, osl.SandboxTypeIngress) } }
[ "func", "OptionIngress", "(", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "ingress", "=", "true", "\n", "sb", ".", "oslTypes", "=", "append", "(", "sb", ".", "oslTypes", ",", "osl", ".", "SandboxTypeIngr...
// OptionIngress function returns an option setter for marking a // sandbox as the controller's ingress sandbox.
[ "OptionIngress", "function", "returns", "an", "option", "setter", "for", "marking", "a", "sandbox", "as", "the", "controller", "s", "ingress", "sandbox", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1186-L1191
22,677
docker/libnetwork
sandbox.go
OptionLoadBalancer
func OptionLoadBalancer(nid string) SandboxOption { return func(sb *sandbox) { sb.loadBalancerNID = nid sb.oslTypes = append(sb.oslTypes, osl.SandboxTypeLoadBalancer) } }
go
func OptionLoadBalancer(nid string) SandboxOption { return func(sb *sandbox) { sb.loadBalancerNID = nid sb.oslTypes = append(sb.oslTypes, osl.SandboxTypeLoadBalancer) } }
[ "func", "OptionLoadBalancer", "(", "nid", "string", ")", "SandboxOption", "{", "return", "func", "(", "sb", "*", "sandbox", ")", "{", "sb", ".", "loadBalancerNID", "=", "nid", "\n", "sb", ".", "oslTypes", "=", "append", "(", "sb", ".", "oslTypes", ",", ...
// OptionLoadBalancer function returns an option setter for marking a // sandbox as a load balancer sandbox.
[ "OptionLoadBalancer", "function", "returns", "an", "option", "setter", "for", "marking", "a", "sandbox", "as", "a", "load", "balancer", "sandbox", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox.go#L1195-L1200
22,678
docker/libnetwork
ns/init_linux.go
Init
func Init() { var err error initNs, err = netns.Get() if err != nil { logrus.Errorf("could not get initial namespace: %v", err) } initNl, err = netlink.NewHandle(getSupportedNlFamilies()...) if err != nil { logrus.Errorf("could not create netlink handle on initial namespace: %v", err) } err = initNl.SetSock...
go
func Init() { var err error initNs, err = netns.Get() if err != nil { logrus.Errorf("could not get initial namespace: %v", err) } initNl, err = netlink.NewHandle(getSupportedNlFamilies()...) if err != nil { logrus.Errorf("could not create netlink handle on initial namespace: %v", err) } err = initNl.SetSock...
[ "func", "Init", "(", ")", "{", "var", "err", "error", "\n", "initNs", ",", "err", "=", "netns", ".", "Get", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "initNl", "...
// Init initializes a new network namespace
[ "Init", "initializes", "a", "new", "network", "namespace" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ns/init_linux.go#L26-L40
22,679
docker/libnetwork
ns/init_linux.go
SetNamespace
func SetNamespace() error { initOnce.Do(Init) if err := netns.Set(initNs); err != nil { linkInfo, linkErr := getLink() if linkErr != nil { linkInfo = linkErr.Error() } return fmt.Errorf("failed to set to initial namespace, %v, initns fd %d: %v", linkInfo, initNs, err) } return nil }
go
func SetNamespace() error { initOnce.Do(Init) if err := netns.Set(initNs); err != nil { linkInfo, linkErr := getLink() if linkErr != nil { linkInfo = linkErr.Error() } return fmt.Errorf("failed to set to initial namespace, %v, initns fd %d: %v", linkInfo, initNs, err) } return nil }
[ "func", "SetNamespace", "(", ")", "error", "{", "initOnce", ".", "Do", "(", "Init", ")", "\n", "if", "err", ":=", "netns", ".", "Set", "(", "initNs", ")", ";", "err", "!=", "nil", "{", "linkInfo", ",", "linkErr", ":=", "getLink", "(", ")", "\n", ...
// SetNamespace sets the initial namespace handler
[ "SetNamespace", "sets", "the", "initial", "namespace", "handler" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ns/init_linux.go#L43-L53
22,680
docker/libnetwork
osl/route_linux.go
programRoute
func (n *networkNamespace) programRoute(path string, dest *net.IPNet, nh net.IP) error { gwRoutes, err := n.nlHandle.RouteGet(nh) if err != nil { return fmt.Errorf("route for the next hop %s could not be found: %v", nh, err) } return n.nlHandle.RouteAdd(&netlink.Route{ Scope: netlink.SCOPE_UNIVERSE, Link...
go
func (n *networkNamespace) programRoute(path string, dest *net.IPNet, nh net.IP) error { gwRoutes, err := n.nlHandle.RouteGet(nh) if err != nil { return fmt.Errorf("route for the next hop %s could not be found: %v", nh, err) } return n.nlHandle.RouteAdd(&netlink.Route{ Scope: netlink.SCOPE_UNIVERSE, Link...
[ "func", "(", "n", "*", "networkNamespace", ")", "programRoute", "(", "path", "string", ",", "dest", "*", "net", ".", "IPNet", ",", "nh", "net", ".", "IP", ")", "error", "{", "gwRoutes", ",", "err", ":=", "n", ".", "nlHandle", ".", "RouteGet", "(", ...
// Program a route in to the namespace routing table.
[ "Program", "a", "route", "in", "to", "the", "namespace", "routing", "table", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/osl/route_linux.go#L114-L126
22,681
docker/libnetwork
cmd/proxy/sctp_proxy.go
NewSCTPProxy
func NewSCTPProxy(frontendAddr, backendAddr *sctp.SCTPAddr) (*SCTPProxy, error) { listener, err := sctp.ListenSCTP("sctp", frontendAddr) if err != nil { return nil, err } // If the port in frontendAddr was 0 then ListenSCTP will have a picked // a port to listen on, hence the call to Addr to get that actual port...
go
func NewSCTPProxy(frontendAddr, backendAddr *sctp.SCTPAddr) (*SCTPProxy, error) { listener, err := sctp.ListenSCTP("sctp", frontendAddr) if err != nil { return nil, err } // If the port in frontendAddr was 0 then ListenSCTP will have a picked // a port to listen on, hence the call to Addr to get that actual port...
[ "func", "NewSCTPProxy", "(", "frontendAddr", ",", "backendAddr", "*", "sctp", ".", "SCTPAddr", ")", "(", "*", "SCTPProxy", ",", "error", ")", "{", "listener", ",", "err", ":=", "sctp", ".", "ListenSCTP", "(", "\"", "\"", ",", "frontendAddr", ")", "\n", ...
// NewSCTPProxy creates a new SCTPProxy.
[ "NewSCTPProxy", "creates", "a", "new", "SCTPProxy", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/cmd/proxy/sctp_proxy.go#L21-L33
22,682
docker/libnetwork
cmd/proxy/sctp_proxy.go
Run
func (proxy *SCTPProxy) Run() { quit := make(chan bool) defer close(quit) for { client, err := proxy.listener.Accept() if err != nil { log.Printf("Stopping proxy on sctp/%v for sctp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err) return } go proxy.clientLoop(client.(*sctp.SCTPConn), quit) } }
go
func (proxy *SCTPProxy) Run() { quit := make(chan bool) defer close(quit) for { client, err := proxy.listener.Accept() if err != nil { log.Printf("Stopping proxy on sctp/%v for sctp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err) return } go proxy.clientLoop(client.(*sctp.SCTPConn), quit) } }
[ "func", "(", "proxy", "*", "SCTPProxy", ")", "Run", "(", ")", "{", "quit", ":=", "make", "(", "chan", "bool", ")", "\n", "defer", "close", "(", "quit", ")", "\n", "for", "{", "client", ",", "err", ":=", "proxy", ".", "listener", ".", "Accept", "(...
// Run starts forwarding the traffic using SCTP.
[ "Run", "starts", "forwarding", "the", "traffic", "using", "SCTP", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/cmd/proxy/sctp_proxy.go#L73-L84
22,683
docker/libnetwork
drivers/windows/port_mapping.go
AllocatePorts
func AllocatePorts(portMapper *portmapper.PortMapper, bindings []types.PortBinding, containerIP net.IP) ([]types.PortBinding, error) { bs := make([]types.PortBinding, 0, len(bindings)) for _, c := range bindings { b := c.GetCopy() if err := allocatePort(portMapper, &b, containerIP); err != nil { // On allocati...
go
func AllocatePorts(portMapper *portmapper.PortMapper, bindings []types.PortBinding, containerIP net.IP) ([]types.PortBinding, error) { bs := make([]types.PortBinding, 0, len(bindings)) for _, c := range bindings { b := c.GetCopy() if err := allocatePort(portMapper, &b, containerIP); err != nil { // On allocati...
[ "func", "AllocatePorts", "(", "portMapper", "*", "portmapper", ".", "PortMapper", ",", "bindings", "[", "]", "types", ".", "PortBinding", ",", "containerIP", "net", ".", "IP", ")", "(", "[", "]", "types", ".", "PortBinding", ",", "error", ")", "{", "bs",...
// AllocatePorts allocates ports specified in bindings from the portMapper
[ "AllocatePorts", "allocates", "ports", "specified", "in", "bindings", "from", "the", "portMapper" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/port_mapping.go#L29-L43
22,684
docker/libnetwork
drivers/windows/port_mapping.go
ReleasePorts
func ReleasePorts(portMapper *portmapper.PortMapper, bindings []types.PortBinding) error { var errorBuf bytes.Buffer // Attempt to release all port bindings, do not stop on failure for _, m := range bindings { if err := releasePort(portMapper, m); err != nil { errorBuf.WriteString(fmt.Sprintf("\ncould not rele...
go
func ReleasePorts(portMapper *portmapper.PortMapper, bindings []types.PortBinding) error { var errorBuf bytes.Buffer // Attempt to release all port bindings, do not stop on failure for _, m := range bindings { if err := releasePort(portMapper, m); err != nil { errorBuf.WriteString(fmt.Sprintf("\ncould not rele...
[ "func", "ReleasePorts", "(", "portMapper", "*", "portmapper", ".", "PortMapper", ",", "bindings", "[", "]", "types", ".", "PortBinding", ")", "error", "{", "var", "errorBuf", "bytes", ".", "Buffer", "\n\n", "// Attempt to release all port bindings, do not stop on fail...
// ReleasePorts releases ports specified in bindings from the portMapper
[ "ReleasePorts", "releases", "ports", "specified", "in", "bindings", "from", "the", "portMapper" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/port_mapping.go#L102-L116
22,685
docker/libnetwork
api/api.go
NewHTTPHandler
func NewHTTPHandler(c libnetwork.NetworkController) func(w http.ResponseWriter, req *http.Request) { h := &httpHandler{c: c} h.initRouter() return h.handleRequest }
go
func NewHTTPHandler(c libnetwork.NetworkController) func(w http.ResponseWriter, req *http.Request) { h := &httpHandler{c: c} h.initRouter() return h.handleRequest }
[ "func", "NewHTTPHandler", "(", "c", "libnetwork", ".", "NetworkController", ")", "func", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "h", ":=", "&", "httpHandler", "{", "c", ":", "c", "}", "\n", "h", "....
// NewHTTPHandler creates and initialize the HTTP handler to serve the requests for libnetwork
[ "NewHTTPHandler", "creates", "and", "initialize", "the", "HTTP", "handler", "to", "serve", "the", "requests", "for", "libnetwork" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/api/api.go#L60-L64
22,686
docker/libnetwork
networkdb/nodemgmt.go
findNode
func (nDB *NetworkDB) findNode(nodeName string) (*node, nodeState, map[string]*node) { for i, nodes := range []map[string]*node{ nDB.nodes, nDB.leftNodes, nDB.failedNodes, } { if n, ok := nodes[nodeName]; ok { return n, nodeState(i), nodes } } return nil, nodeNotFound, nil }
go
func (nDB *NetworkDB) findNode(nodeName string) (*node, nodeState, map[string]*node) { for i, nodes := range []map[string]*node{ nDB.nodes, nDB.leftNodes, nDB.failedNodes, } { if n, ok := nodes[nodeName]; ok { return n, nodeState(i), nodes } } return nil, nodeNotFound, nil }
[ "func", "(", "nDB", "*", "NetworkDB", ")", "findNode", "(", "nodeName", "string", ")", "(", "*", "node", ",", "nodeState", ",", "map", "[", "string", "]", "*", "node", ")", "{", "for", "i", ",", "nodes", ":=", "range", "[", "]", "map", "[", "stri...
// findNode search the node into the 3 node lists and returns the node pointer and the list // where it got found
[ "findNode", "search", "the", "node", "into", "the", "3", "node", "lists", "and", "returns", "the", "node", "pointer", "and", "the", "list", "where", "it", "got", "found" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/nodemgmt.go#L28-L39
22,687
docker/libnetwork
networkdb/nodemgmt.go
changeNodeState
func (nDB *NetworkDB) changeNodeState(nodeName string, newState nodeState) (bool, error) { n, currState, m := nDB.findNode(nodeName) if n == nil { return false, fmt.Errorf("node %s not found", nodeName) } switch newState { case nodeActiveState: if currState == nodeActiveState { return false, nil } del...
go
func (nDB *NetworkDB) changeNodeState(nodeName string, newState nodeState) (bool, error) { n, currState, m := nDB.findNode(nodeName) if n == nil { return false, fmt.Errorf("node %s not found", nodeName) } switch newState { case nodeActiveState: if currState == nodeActiveState { return false, nil } del...
[ "func", "(", "nDB", "*", "NetworkDB", ")", "changeNodeState", "(", "nodeName", "string", ",", "newState", "nodeState", ")", "(", "bool", ",", "error", ")", "{", "n", ",", "currState", ",", "m", ":=", "nDB", ".", "findNode", "(", "nodeName", ")", "\n", ...
// changeNodeState changes the state of the node specified, returns true if the node was moved, // false if there was no need to change the node state. Error will be returned if the node does not // exists
[ "changeNodeState", "changes", "the", "state", "of", "the", "node", "specified", "returns", "true", "if", "the", "node", "was", "moved", "false", "if", "there", "was", "no", "need", "to", "change", "the", "node", "state", ".", "Error", "will", "be", "return...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/nodemgmt.go#L44-L92
22,688
docker/libnetwork
networkdb/message.go
decodeCompoundMessage
func decodeCompoundMessage(buf []byte) ([][]byte, error) { var cMsg CompoundMessage if err := proto.Unmarshal(buf, &cMsg); err != nil { return nil, err } parts := make([][]byte, 0, len(cMsg.Messages)) for _, m := range cMsg.Messages { parts = append(parts, m.Payload) } return parts, nil }
go
func decodeCompoundMessage(buf []byte) ([][]byte, error) { var cMsg CompoundMessage if err := proto.Unmarshal(buf, &cMsg); err != nil { return nil, err } parts := make([][]byte, 0, len(cMsg.Messages)) for _, m := range cMsg.Messages { parts = append(parts, m.Payload) } return parts, nil }
[ "func", "decodeCompoundMessage", "(", "buf", "[", "]", "byte", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "var", "cMsg", "CompoundMessage", "\n", "if", "err", ":=", "proto", ".", "Unmarshal", "(", "buf", ",", "&", "cMsg", ")", ";...
// decodeCompoundMessage splits a compound message and returns // the slices of individual messages. Returns any potential error.
[ "decodeCompoundMessage", "splits", "a", "compound", "message", "and", "returns", "the", "slices", "of", "individual", "messages", ".", "Returns", "any", "potential", "error", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/message.go#L86-L98
22,689
docker/libnetwork
bitseq/sequence.go
NewHandle
func NewHandle(app string, ds datastore.DataStore, id string, numElements uint64) (*Handle, error) { h := &Handle{ app: app, id: id, store: ds, bits: numElements, unselected: numElements, head: &sequence{ block: 0x0, count: getNumBlocks(numElements), }, } if h.store == ...
go
func NewHandle(app string, ds datastore.DataStore, id string, numElements uint64) (*Handle, error) { h := &Handle{ app: app, id: id, store: ds, bits: numElements, unselected: numElements, head: &sequence{ block: 0x0, count: getNumBlocks(numElements), }, } if h.store == ...
[ "func", "NewHandle", "(", "app", "string", ",", "ds", "datastore", ".", "DataStore", ",", "id", "string", ",", "numElements", "uint64", ")", "(", "*", "Handle", ",", "error", ")", "{", "h", ":=", "&", "Handle", "{", "app", ":", "app", ",", "id", ":...
// NewHandle returns a thread-safe instance of the bitmask handler
[ "NewHandle", "returns", "a", "thread", "-", "safe", "instance", "of", "the", "bitmask", "handler" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L50-L80
22,690
docker/libnetwork
bitseq/sequence.go
toString
func (s *sequence) toString() string { var nextBlock string if s.next == nil { nextBlock = "end" } else { nextBlock = s.next.toString() } return fmt.Sprintf("(0x%x, %d)->%s", s.block, s.count, nextBlock) }
go
func (s *sequence) toString() string { var nextBlock string if s.next == nil { nextBlock = "end" } else { nextBlock = s.next.toString() } return fmt.Sprintf("(0x%x, %d)->%s", s.block, s.count, nextBlock) }
[ "func", "(", "s", "*", "sequence", ")", "toString", "(", ")", "string", "{", "var", "nextBlock", "string", "\n", "if", "s", ".", "next", "==", "nil", "{", "nextBlock", "=", "\"", "\"", "\n", "}", "else", "{", "nextBlock", "=", "s", ".", "next", "...
// String returns a string representation of the block sequence starting from this block
[ "String", "returns", "a", "string", "representation", "of", "the", "block", "sequence", "starting", "from", "this", "block" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L90-L98
22,691
docker/libnetwork
bitseq/sequence.go
getAvailableBit
func (s *sequence) getAvailableBit(from uint64) (uint64, uint64, error) { if s.block == blockMAX || s.count == 0 { return invalidPos, invalidPos, ErrNoBitAvailable } bits := from bitSel := blockFirstBit >> from for bitSel > 0 && s.block&bitSel != 0 { bitSel >>= 1 bits++ } // Check if the loop exited becaus...
go
func (s *sequence) getAvailableBit(from uint64) (uint64, uint64, error) { if s.block == blockMAX || s.count == 0 { return invalidPos, invalidPos, ErrNoBitAvailable } bits := from bitSel := blockFirstBit >> from for bitSel > 0 && s.block&bitSel != 0 { bitSel >>= 1 bits++ } // Check if the loop exited becaus...
[ "func", "(", "s", "*", "sequence", ")", "getAvailableBit", "(", "from", "uint64", ")", "(", "uint64", ",", "uint64", ",", "error", ")", "{", "if", "s", ".", "block", "==", "blockMAX", "||", "s", ".", "count", "==", "0", "{", "return", "invalidPos", ...
// GetAvailableBit returns the position of the first unset bit in the bitmask represented by this sequence
[ "GetAvailableBit", "returns", "the", "position", "of", "the", "first", "unset", "bit", "in", "the", "bitmask", "represented", "by", "this", "sequence" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L101-L118
22,692
docker/libnetwork
bitseq/sequence.go
getCopy
func (s *sequence) getCopy() *sequence { n := &sequence{block: s.block, count: s.count} pn := n ps := s.next for ps != nil { pn.next = &sequence{block: ps.block, count: ps.count} pn = pn.next ps = ps.next } return n }
go
func (s *sequence) getCopy() *sequence { n := &sequence{block: s.block, count: s.count} pn := n ps := s.next for ps != nil { pn.next = &sequence{block: ps.block, count: ps.count} pn = pn.next ps = ps.next } return n }
[ "func", "(", "s", "*", "sequence", ")", "getCopy", "(", ")", "*", "sequence", "{", "n", ":=", "&", "sequence", "{", "block", ":", "s", ".", "block", ",", "count", ":", "s", ".", "count", "}", "\n", "pn", ":=", "n", "\n", "ps", ":=", "s", ".",...
// GetCopy returns a copy of the linked list rooted at this node
[ "GetCopy", "returns", "a", "copy", "of", "the", "linked", "list", "rooted", "at", "this", "node" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L121-L131
22,693
docker/libnetwork
bitseq/sequence.go
equal
func (s *sequence) equal(o *sequence) bool { this := s other := o for this != nil { if other == nil { return false } if this.block != other.block || this.count != other.count { return false } this = this.next other = other.next } // Check if other is longer than this if other != nil { return f...
go
func (s *sequence) equal(o *sequence) bool { this := s other := o for this != nil { if other == nil { return false } if this.block != other.block || this.count != other.count { return false } this = this.next other = other.next } // Check if other is longer than this if other != nil { return f...
[ "func", "(", "s", "*", "sequence", ")", "equal", "(", "o", "*", "sequence", ")", "bool", "{", "this", ":=", "s", "\n", "other", ":=", "o", "\n", "for", "this", "!=", "nil", "{", "if", "other", "==", "nil", "{", "return", "false", "\n", "}", "\n...
// Equal checks if this sequence is equal to the passed one
[ "Equal", "checks", "if", "this", "sequence", "is", "equal", "to", "the", "passed", "one" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L134-L152
22,694
docker/libnetwork
bitseq/sequence.go
toByteArray
func (s *sequence) toByteArray() ([]byte, error) { var bb []byte p := s for p != nil { b := make([]byte, 12) binary.BigEndian.PutUint32(b[0:], p.block) binary.BigEndian.PutUint64(b[4:], p.count) bb = append(bb, b...) p = p.next } return bb, nil }
go
func (s *sequence) toByteArray() ([]byte, error) { var bb []byte p := s for p != nil { b := make([]byte, 12) binary.BigEndian.PutUint32(b[0:], p.block) binary.BigEndian.PutUint64(b[4:], p.count) bb = append(bb, b...) p = p.next } return bb, nil }
[ "func", "(", "s", "*", "sequence", ")", "toByteArray", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "bb", "[", "]", "byte", "\n\n", "p", ":=", "s", "\n", "for", "p", "!=", "nil", "{", "b", ":=", "make", "(", "[", "]", "by...
// ToByteArray converts the sequence into a byte array
[ "ToByteArray", "converts", "the", "sequence", "into", "a", "byte", "array" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L155-L168
22,695
docker/libnetwork
bitseq/sequence.go
fromByteArray
func (s *sequence) fromByteArray(data []byte) error { l := len(data) if l%12 != 0 { return fmt.Errorf("cannot deserialize byte sequence of length %d (%v)", l, data) } p := s i := 0 for { p.block = binary.BigEndian.Uint32(data[i : i+4]) p.count = binary.BigEndian.Uint64(data[i+4 : i+12]) i += 12 if i ==...
go
func (s *sequence) fromByteArray(data []byte) error { l := len(data) if l%12 != 0 { return fmt.Errorf("cannot deserialize byte sequence of length %d (%v)", l, data) } p := s i := 0 for { p.block = binary.BigEndian.Uint32(data[i : i+4]) p.count = binary.BigEndian.Uint64(data[i+4 : i+12]) i += 12 if i ==...
[ "func", "(", "s", "*", "sequence", ")", "fromByteArray", "(", "data", "[", "]", "byte", ")", "error", "{", "l", ":=", "len", "(", "data", ")", "\n", "if", "l", "%", "12", "!=", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "...
// fromByteArray construct the sequence from the byte array
[ "fromByteArray", "construct", "the", "sequence", "from", "the", "byte", "array" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L171-L191
22,696
docker/libnetwork
bitseq/sequence.go
SetAnyInRange
func (h *Handle) SetAnyInRange(start, end uint64, serial bool) (uint64, error) { if end < start || end >= h.bits { return invalidPos, fmt.Errorf("invalid bit range [%d, %d]", start, end) } if h.Unselected() == 0 { return invalidPos, ErrNoBitAvailable } return h.set(0, start, end, true, false, serial) }
go
func (h *Handle) SetAnyInRange(start, end uint64, serial bool) (uint64, error) { if end < start || end >= h.bits { return invalidPos, fmt.Errorf("invalid bit range [%d, %d]", start, end) } if h.Unselected() == 0 { return invalidPos, ErrNoBitAvailable } return h.set(0, start, end, true, false, serial) }
[ "func", "(", "h", "*", "Handle", ")", "SetAnyInRange", "(", "start", ",", "end", "uint64", ",", "serial", "bool", ")", "(", "uint64", ",", "error", ")", "{", "if", "end", "<", "start", "||", "end", ">=", "h", ".", "bits", "{", "return", "invalidPos...
// SetAnyInRange atomically sets the first unset bit in the specified range in the sequence and returns the corresponding ordinal
[ "SetAnyInRange", "atomically", "sets", "the", "first", "unset", "bit", "in", "the", "specified", "range", "in", "the", "sequence", "and", "returns", "the", "corresponding", "ordinal" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L208-L216
22,697
docker/libnetwork
bitseq/sequence.go
SetAny
func (h *Handle) SetAny(serial bool) (uint64, error) { if h.Unselected() == 0 { return invalidPos, ErrNoBitAvailable } return h.set(0, 0, h.bits-1, true, false, serial) }
go
func (h *Handle) SetAny(serial bool) (uint64, error) { if h.Unselected() == 0 { return invalidPos, ErrNoBitAvailable } return h.set(0, 0, h.bits-1, true, false, serial) }
[ "func", "(", "h", "*", "Handle", ")", "SetAny", "(", "serial", "bool", ")", "(", "uint64", ",", "error", ")", "{", "if", "h", ".", "Unselected", "(", ")", "==", "0", "{", "return", "invalidPos", ",", "ErrNoBitAvailable", "\n", "}", "\n", "return", ...
// SetAny atomically sets the first unset bit in the sequence and returns the corresponding ordinal
[ "SetAny", "atomically", "sets", "the", "first", "unset", "bit", "in", "the", "sequence", "and", "returns", "the", "corresponding", "ordinal" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L219-L224
22,698
docker/libnetwork
bitseq/sequence.go
Set
func (h *Handle) Set(ordinal uint64) error { if err := h.validateOrdinal(ordinal); err != nil { return err } _, err := h.set(ordinal, 0, 0, false, false, false) return err }
go
func (h *Handle) Set(ordinal uint64) error { if err := h.validateOrdinal(ordinal); err != nil { return err } _, err := h.set(ordinal, 0, 0, false, false, false) return err }
[ "func", "(", "h", "*", "Handle", ")", "Set", "(", "ordinal", "uint64", ")", "error", "{", "if", "err", ":=", "h", ".", "validateOrdinal", "(", "ordinal", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", ":=", ...
// Set atomically sets the corresponding bit in the sequence
[ "Set", "atomically", "sets", "the", "corresponding", "bit", "in", "the", "sequence" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L227-L233
22,699
docker/libnetwork
bitseq/sequence.go
Unset
func (h *Handle) Unset(ordinal uint64) error { if err := h.validateOrdinal(ordinal); err != nil { return err } _, err := h.set(ordinal, 0, 0, false, true, false) return err }
go
func (h *Handle) Unset(ordinal uint64) error { if err := h.validateOrdinal(ordinal); err != nil { return err } _, err := h.set(ordinal, 0, 0, false, true, false) return err }
[ "func", "(", "h", "*", "Handle", ")", "Unset", "(", "ordinal", "uint64", ")", "error", "{", "if", "err", ":=", "h", ".", "validateOrdinal", "(", "ordinal", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", ":="...
// Unset atomically unsets the corresponding bit in the sequence
[ "Unset", "atomically", "unsets", "the", "corresponding", "bit", "in", "the", "sequence" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/sequence.go#L236-L242