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,500 | docker/libnetwork | netutils/utils.go | NetworkRange | func NetworkRange(network *net.IPNet) (net.IP, net.IP) {
if network == nil {
return nil, nil
}
firstIP := network.IP.Mask(network.Mask)
lastIP := types.GetIPCopy(firstIP)
for i := 0; i < len(firstIP); i++ {
lastIP[i] = firstIP[i] | ^network.Mask[i]
}
if network.IP.To4() != nil {
firstIP = firstIP.To4()
... | go | func NetworkRange(network *net.IPNet) (net.IP, net.IP) {
if network == nil {
return nil, nil
}
firstIP := network.IP.Mask(network.Mask)
lastIP := types.GetIPCopy(firstIP)
for i := 0; i < len(firstIP); i++ {
lastIP[i] = firstIP[i] | ^network.Mask[i]
}
if network.IP.To4() != nil {
firstIP = firstIP.To4()
... | [
"func",
"NetworkRange",
"(",
"network",
"*",
"net",
".",
"IPNet",
")",
"(",
"net",
".",
"IP",
",",
"net",
".",
"IP",
")",
"{",
"if",
"network",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"firstIP",
":=",
"network",
".",
"IP... | // NetworkRange calculates the first and last IP addresses in an IPNet | [
"NetworkRange",
"calculates",
"the",
"first",
"and",
"last",
"IP",
"addresses",
"in",
"an",
"IPNet"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L48-L65 |
22,501 | docker/libnetwork | netutils/utils.go | GetIfaceAddr | func GetIfaceAddr(name string) (net.Addr, []net.Addr, error) {
iface, err := net.InterfaceByName(name)
if err != nil {
return nil, nil, err
}
addrs, err := iface.Addrs()
if err != nil {
return nil, nil, err
}
var addrs4 []net.Addr
var addrs6 []net.Addr
for _, addr := range addrs {
ip := (addr.(*net.IPNet... | go | func GetIfaceAddr(name string) (net.Addr, []net.Addr, error) {
iface, err := net.InterfaceByName(name)
if err != nil {
return nil, nil, err
}
addrs, err := iface.Addrs()
if err != nil {
return nil, nil, err
}
var addrs4 []net.Addr
var addrs6 []net.Addr
for _, addr := range addrs {
ip := (addr.(*net.IPNet... | [
"func",
"GetIfaceAddr",
"(",
"name",
"string",
")",
"(",
"net",
".",
"Addr",
",",
"[",
"]",
"net",
".",
"Addr",
",",
"error",
")",
"{",
"iface",
",",
"err",
":=",
"net",
".",
"InterfaceByName",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // GetIfaceAddr returns the first IPv4 address and slice of IPv6 addresses for the specified network interface | [
"GetIfaceAddr",
"returns",
"the",
"first",
"IPv4",
"address",
"and",
"slice",
"of",
"IPv6",
"addresses",
"for",
"the",
"specified",
"network",
"interface"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L68-L95 |
22,502 | docker/libnetwork | netutils/utils.go | GenerateRandomName | func GenerateRandomName(prefix string, size int) (string, error) {
id := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, id); err != nil {
return "", err
}
return prefix + hex.EncodeToString(id)[:size], nil
} | go | func GenerateRandomName(prefix string, size int) (string, error) {
id := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, id); err != nil {
return "", err
}
return prefix + hex.EncodeToString(id)[:size], nil
} | [
"func",
"GenerateRandomName",
"(",
"prefix",
"string",
",",
"size",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"id",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"32",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"rand... | // GenerateRandomName returns a new name joined with a prefix. This size
// specified is used to truncate the randomly generated value | [
"GenerateRandomName",
"returns",
"a",
"new",
"name",
"joined",
"with",
"a",
"prefix",
".",
"This",
"size",
"specified",
"is",
"used",
"to",
"truncate",
"the",
"randomly",
"generated",
"value"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L129-L135 |
22,503 | docker/libnetwork | netutils/utils.go | ReverseIP | func ReverseIP(IP string) string {
var reverseIP []string
if net.ParseIP(IP).To4() != nil {
reverseIP = strings.Split(IP, ".")
l := len(reverseIP)
for i, j := 0, l-1; i < l/2; i, j = i+1, j-1 {
reverseIP[i], reverseIP[j] = reverseIP[j], reverseIP[i]
}
} else {
reverseIP = strings.Split(IP, ":")
// R... | go | func ReverseIP(IP string) string {
var reverseIP []string
if net.ParseIP(IP).To4() != nil {
reverseIP = strings.Split(IP, ".")
l := len(reverseIP)
for i, j := 0, l-1; i < l/2; i, j = i+1, j-1 {
reverseIP[i], reverseIP[j] = reverseIP[j], reverseIP[i]
}
} else {
reverseIP = strings.Split(IP, ":")
// R... | [
"func",
"ReverseIP",
"(",
"IP",
"string",
")",
"string",
"{",
"var",
"reverseIP",
"[",
"]",
"string",
"\n\n",
"if",
"net",
".",
"ParseIP",
"(",
"IP",
")",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"reverseIP",
"=",
"strings",
".",
"Split",
"(",
"IP",... | // ReverseIP accepts a V4 or V6 IP string in the canonical form and returns a reversed IP in
// the dotted decimal form . This is used to setup the IP to service name mapping in the optimal
// way for the DNS PTR queries. | [
"ReverseIP",
"accepts",
"a",
"V4",
"or",
"V6",
"IP",
"string",
"in",
"the",
"canonical",
"form",
"and",
"returns",
"a",
"reversed",
"IP",
"in",
"the",
"dotted",
"decimal",
"form",
".",
"This",
"is",
"used",
"to",
"setup",
"the",
"IP",
"to",
"service",
... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L140-L171 |
22,504 | docker/libnetwork | ipvs/netlink.go | assembleService | func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) {
var s Service
for _, attr := range attrs {
attrType := int(attr.Attr.Type)
switch attrType {
case ipvsSvcAttrAddressFamily:
s.AddressFamily = native.Uint16(attr.Value)
case ipvsSvcAttrProtocol:
s.Protocol = native.Uint16(att... | go | func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) {
var s Service
for _, attr := range attrs {
attrType := int(attr.Attr.Type)
switch attrType {
case ipvsSvcAttrAddressFamily:
s.AddressFamily = native.Uint16(attr.Value)
case ipvsSvcAttrProtocol:
s.Protocol = native.Uint16(att... | [
"func",
"assembleService",
"(",
"attrs",
"[",
"]",
"syscall",
".",
"NetlinkRouteAttr",
")",
"(",
"*",
"Service",
",",
"error",
")",
"{",
"var",
"s",
"Service",
"\n\n",
"for",
"_",
",",
"attr",
":=",
"range",
"attrs",
"{",
"attrType",
":=",
"int",
"(",
... | // assembleService assembles a services back from a hain of netlink attributes | [
"assembleService",
"assembles",
"a",
"services",
"back",
"from",
"a",
"hain",
"of",
"netlink",
"attributes"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L315-L357 |
22,505 | docker/libnetwork | ipvs/netlink.go | parseService | func (i *Handle) parseService(msg []byte) (*Service, error) {
var s *Service
//Remove General header for this message and parse the NetLink message
hdr := deserializeGenlMsg(msg)
NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
if err != nil {
return nil, err
}
if len(NetLinkAttrs) == 0 {
return nil... | go | func (i *Handle) parseService(msg []byte) (*Service, error) {
var s *Service
//Remove General header for this message and parse the NetLink message
hdr := deserializeGenlMsg(msg)
NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
if err != nil {
return nil, err
}
if len(NetLinkAttrs) == 0 {
return nil... | [
"func",
"(",
"i",
"*",
"Handle",
")",
"parseService",
"(",
"msg",
"[",
"]",
"byte",
")",
"(",
"*",
"Service",
",",
"error",
")",
"{",
"var",
"s",
"*",
"Service",
"\n\n",
"//Remove General header for this message and parse the NetLink message",
"hdr",
":=",
"de... | // parseService given a ipvs netlink response this function will respond with a valid service entry, an error otherwise | [
"parseService",
"given",
"a",
"ipvs",
"netlink",
"response",
"this",
"function",
"will",
"respond",
"with",
"a",
"valid",
"service",
"entry",
"an",
"error",
"otherwise"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L360-L387 |
22,506 | docker/libnetwork | ipvs/netlink.go | doCmdWithoutAttr | func (i *Handle) doCmdWithoutAttr(cmd uint8) ([][]byte, error) {
req := newIPVSRequest(cmd)
req.Seq = atomic.AddUint32(&i.seq, 1)
return execute(i.sock, req, 0)
} | go | func (i *Handle) doCmdWithoutAttr(cmd uint8) ([][]byte, error) {
req := newIPVSRequest(cmd)
req.Seq = atomic.AddUint32(&i.seq, 1)
return execute(i.sock, req, 0)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"doCmdWithoutAttr",
"(",
"cmd",
"uint8",
")",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"req",
":=",
"newIPVSRequest",
"(",
"cmd",
")",
"\n",
"req",
".",
"Seq",
"=",
"atomic",
".",
"AddUint32",
... | // doCmdWithoutAttr a simple wrapper of netlink socket execute command | [
"doCmdWithoutAttr",
"a",
"simple",
"wrapper",
"of",
"netlink",
"socket",
"execute",
"command"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L410-L414 |
22,507 | docker/libnetwork | ipvs/netlink.go | parseDestination | func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
var dst *Destination
//Remove General header for this message
hdr := deserializeGenlMsg(msg)
NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
if err != nil {
return nil, err
}
if len(NetLinkAttrs) == 0 {
return nil, fmt.Errorf("err... | go | func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
var dst *Destination
//Remove General header for this message
hdr := deserializeGenlMsg(msg)
NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
if err != nil {
return nil, err
}
if len(NetLinkAttrs) == 0 {
return nil, fmt.Errorf("err... | [
"func",
"(",
"i",
"*",
"Handle",
")",
"parseDestination",
"(",
"msg",
"[",
"]",
"byte",
")",
"(",
"*",
"Destination",
",",
"error",
")",
"{",
"var",
"dst",
"*",
"Destination",
"\n\n",
"//Remove General header for this message",
"hdr",
":=",
"deserializeGenlMsg... | // parseDestination given a ipvs netlink response this function will respond with a valid destination entry, an error otherwise | [
"parseDestination",
"given",
"a",
"ipvs",
"netlink",
"response",
"this",
"function",
"will",
"respond",
"with",
"a",
"valid",
"destination",
"entry",
"an",
"error",
"otherwise"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L459-L485 |
22,508 | docker/libnetwork | ipvs/netlink.go | parseConfig | func (i *Handle) parseConfig(msg []byte) (*Config, error) {
var c Config
//Remove General header for this message
hdr := deserializeGenlMsg(msg)
attrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
if err != nil {
return nil, err
}
for _, attr := range attrs {
attrType := int(attr.Attr.Type)
switch attrType ... | go | func (i *Handle) parseConfig(msg []byte) (*Config, error) {
var c Config
//Remove General header for this message
hdr := deserializeGenlMsg(msg)
attrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
if err != nil {
return nil, err
}
for _, attr := range attrs {
attrType := int(attr.Attr.Type)
switch attrType ... | [
"func",
"(",
"i",
"*",
"Handle",
")",
"parseConfig",
"(",
"msg",
"[",
"]",
"byte",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"var",
"c",
"Config",
"\n\n",
"//Remove General header for this message",
"hdr",
":=",
"deserializeGenlMsg",
"(",
"msg",
")"... | // parseConfig given a ipvs netlink response this function will respond with a valid config entry, an error otherwise | [
"parseConfig",
"given",
"a",
"ipvs",
"netlink",
"response",
"this",
"function",
"will",
"respond",
"with",
"a",
"valid",
"config",
"entry",
"an",
"error",
"otherwise"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L508-L531 |
22,509 | docker/libnetwork | ipvs/netlink.go | doGetConfigCmd | func (i *Handle) doGetConfigCmd() (*Config, error) {
msg, err := i.doCmdWithoutAttr(ipvsCmdGetConfig)
if err != nil {
return nil, err
}
res, err := i.parseConfig(msg[0])
if err != nil {
return res, err
}
return res, nil
} | go | func (i *Handle) doGetConfigCmd() (*Config, error) {
msg, err := i.doCmdWithoutAttr(ipvsCmdGetConfig)
if err != nil {
return nil, err
}
res, err := i.parseConfig(msg[0])
if err != nil {
return res, err
}
return res, nil
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"doGetConfigCmd",
"(",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"msg",
",",
"err",
":=",
"i",
".",
"doCmdWithoutAttr",
"(",
"ipvsCmdGetConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
... | // doGetConfigCmd a wrapper function to be used by GetConfig | [
"doGetConfigCmd",
"a",
"wrapper",
"function",
"to",
"be",
"used",
"by",
"GetConfig"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L534-L545 |
22,510 | docker/libnetwork | ipvs/netlink.go | doSetConfigCmd | func (i *Handle) doSetConfigCmd(c *Config) error {
req := newIPVSRequest(ipvsCmdSetConfig)
req.Seq = atomic.AddUint32(&i.seq, 1)
req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCP, nl.Uint32Attr(uint32(c.TimeoutTCP.Seconds()))))
req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCPFin, nl.Uint32Attr(uint32(c.TimeoutTCPFin.Se... | go | func (i *Handle) doSetConfigCmd(c *Config) error {
req := newIPVSRequest(ipvsCmdSetConfig)
req.Seq = atomic.AddUint32(&i.seq, 1)
req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCP, nl.Uint32Attr(uint32(c.TimeoutTCP.Seconds()))))
req.AddData(nl.NewRtAttr(ipvsCmdAttrTimeoutTCPFin, nl.Uint32Attr(uint32(c.TimeoutTCPFin.Se... | [
"func",
"(",
"i",
"*",
"Handle",
")",
"doSetConfigCmd",
"(",
"c",
"*",
"Config",
")",
"error",
"{",
"req",
":=",
"newIPVSRequest",
"(",
"ipvsCmdSetConfig",
")",
"\n",
"req",
".",
"Seq",
"=",
"atomic",
".",
"AddUint32",
"(",
"&",
"i",
".",
"seq",
",",... | // doSetConfigCmd a wrapper function to be used by SetConfig | [
"doSetConfigCmd",
"a",
"wrapper",
"function",
"to",
"be",
"used",
"by",
"SetConfig"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/netlink.go#L548-L559 |
22,511 | docker/libnetwork | drivers/bridge/setup_device.go | setupDeviceUp | func setupDeviceUp(config *networkConfiguration, i *bridgeInterface) error {
err := i.nlh.LinkSetUp(i.Link)
if err != nil {
return fmt.Errorf("Failed to set link up for %s: %v", config.BridgeName, err)
}
// Attempt to update the bridge interface to refresh the flags status,
// ignoring any failure to do so.
if... | go | func setupDeviceUp(config *networkConfiguration, i *bridgeInterface) error {
err := i.nlh.LinkSetUp(i.Link)
if err != nil {
return fmt.Errorf("Failed to set link up for %s: %v", config.BridgeName, err)
}
// Attempt to update the bridge interface to refresh the flags status,
// ignoring any failure to do so.
if... | [
"func",
"setupDeviceUp",
"(",
"config",
"*",
"networkConfiguration",
",",
"i",
"*",
"bridgeInterface",
")",
"error",
"{",
"err",
":=",
"i",
".",
"nlh",
".",
"LinkSetUp",
"(",
"i",
".",
"Link",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
... | // SetupDeviceUp ups the given bridge interface. | [
"SetupDeviceUp",
"ups",
"the",
"given",
"bridge",
"interface",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_device.go#L54-L68 |
22,512 | docker/libnetwork | portallocator/portallocator.go | Error | func (e ErrPortAlreadyAllocated) Error() string {
return fmt.Sprintf("Bind for %s:%d failed: port is already allocated", e.ip, e.port)
} | go | func (e ErrPortAlreadyAllocated) Error() string {
return fmt.Sprintf("Bind for %s:%d failed: port is already allocated", e.ip, e.port)
} | [
"func",
"(",
"e",
"ErrPortAlreadyAllocated",
")",
"Error",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"ip",
",",
"e",
".",
"port",
")",
"\n",
"}"
] | // Error is the implementation of error.Error interface | [
"Error",
"is",
"the",
"implementation",
"of",
"error",
".",
"Error",
"interface"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L59-L61 |
22,513 | docker/libnetwork | portallocator/portallocator.go | RequestPort | func (p *PortAllocator) RequestPort(ip net.IP, proto string, port int) (int, error) {
return p.RequestPortInRange(ip, proto, port, port)
} | go | func (p *PortAllocator) RequestPort(ip net.IP, proto string, port int) (int, error) {
return p.RequestPortInRange(ip, proto, port, port)
} | [
"func",
"(",
"p",
"*",
"PortAllocator",
")",
"RequestPort",
"(",
"ip",
"net",
".",
"IP",
",",
"proto",
"string",
",",
"port",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"p",
".",
"RequestPortInRange",
"(",
"ip",
",",
"proto",
",",
"p... | // RequestPort requests new port from global ports pool for specified ip and proto.
// If port is 0 it returns first free port. Otherwise it checks port availability
// in proto's pool and returns that port or error if port is already busy. | [
"RequestPort",
"requests",
"new",
"port",
"from",
"global",
"ports",
"pool",
"for",
"specified",
"ip",
"and",
"proto",
".",
"If",
"port",
"is",
"0",
"it",
"returns",
"first",
"free",
"port",
".",
"Otherwise",
"it",
"checks",
"port",
"availability",
"in",
"... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L110-L112 |
22,514 | docker/libnetwork | portallocator/portallocator.go | ReleasePort | func (p *PortAllocator) ReleasePort(ip net.IP, proto string, port int) error {
p.mutex.Lock()
defer p.mutex.Unlock()
if ip == nil {
ip = defaultIP
}
protomap, ok := p.ipMap[ip.String()]
if !ok {
return nil
}
delete(protomap[proto].p, port)
return nil
} | go | func (p *PortAllocator) ReleasePort(ip net.IP, proto string, port int) error {
p.mutex.Lock()
defer p.mutex.Unlock()
if ip == nil {
ip = defaultIP
}
protomap, ok := p.ipMap[ip.String()]
if !ok {
return nil
}
delete(protomap[proto].p, port)
return nil
} | [
"func",
"(",
"p",
"*",
"PortAllocator",
")",
"ReleasePort",
"(",
"ip",
"net",
".",
"IP",
",",
"proto",
"string",
",",
"port",
"int",
")",
"error",
"{",
"p",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"mutex",
".",
"Unlock",
"("... | // ReleasePort releases port from global ports pool for specified ip and proto. | [
"ReleasePort",
"releases",
"port",
"from",
"global",
"ports",
"pool",
"for",
"specified",
"ip",
"and",
"proto",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L158-L171 |
22,515 | docker/libnetwork | portallocator/portallocator.go | ReleaseAll | func (p *PortAllocator) ReleaseAll() error {
p.mutex.Lock()
p.ipMap = ipMapping{}
p.mutex.Unlock()
return nil
} | go | func (p *PortAllocator) ReleaseAll() error {
p.mutex.Lock()
p.ipMap = ipMapping{}
p.mutex.Unlock()
return nil
} | [
"func",
"(",
"p",
"*",
"PortAllocator",
")",
"ReleaseAll",
"(",
")",
"error",
"{",
"p",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"p",
".",
"ipMap",
"=",
"ipMapping",
"{",
"}",
"\n",
"p",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
... | // ReleaseAll releases all ports for all ips. | [
"ReleaseAll",
"releases",
"all",
"ports",
"for",
"all",
"ips",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portallocator/portallocator.go#L186-L191 |
22,516 | docker/libnetwork | drivers/macvlan/macvlan_setup.go | createMacVlan | func createMacVlan(containerIfName, parent, macvlanMode string) (string, error) {
// Set the macvlan mode. Default is bridge mode
mode, err := setMacVlanMode(macvlanMode)
if err != nil {
return "", fmt.Errorf("Unsupported %s macvlan mode: %v", macvlanMode, err)
}
// verify the Docker host interface acting as the... | go | func createMacVlan(containerIfName, parent, macvlanMode string) (string, error) {
// Set the macvlan mode. Default is bridge mode
mode, err := setMacVlanMode(macvlanMode)
if err != nil {
return "", fmt.Errorf("Unsupported %s macvlan mode: %v", macvlanMode, err)
}
// verify the Docker host interface acting as the... | [
"func",
"createMacVlan",
"(",
"containerIfName",
",",
"parent",
",",
"macvlanMode",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Set the macvlan mode. Default is bridge mode",
"mode",
",",
"err",
":=",
"setMacVlanMode",
"(",
"macvlanMode",
")",
"\n",
... | // Create the macvlan slave specifying the source name | [
"Create",
"the",
"macvlan",
"slave",
"specifying",
"the",
"source",
"name"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_setup.go#L20-L49 |
22,517 | docker/libnetwork | drivers/macvlan/macvlan_setup.go | setMacVlanMode | func setMacVlanMode(mode string) (netlink.MacvlanMode, error) {
switch mode {
case modePrivate:
return netlink.MACVLAN_MODE_PRIVATE, nil
case modeVepa:
return netlink.MACVLAN_MODE_VEPA, nil
case modeBridge:
return netlink.MACVLAN_MODE_BRIDGE, nil
case modePassthru:
return netlink.MACVLAN_MODE_PASSTHRU, nil... | go | func setMacVlanMode(mode string) (netlink.MacvlanMode, error) {
switch mode {
case modePrivate:
return netlink.MACVLAN_MODE_PRIVATE, nil
case modeVepa:
return netlink.MACVLAN_MODE_VEPA, nil
case modeBridge:
return netlink.MACVLAN_MODE_BRIDGE, nil
case modePassthru:
return netlink.MACVLAN_MODE_PASSTHRU, nil... | [
"func",
"setMacVlanMode",
"(",
"mode",
"string",
")",
"(",
"netlink",
".",
"MacvlanMode",
",",
"error",
")",
"{",
"switch",
"mode",
"{",
"case",
"modePrivate",
":",
"return",
"netlink",
".",
"MACVLAN_MODE_PRIVATE",
",",
"nil",
"\n",
"case",
"modeVepa",
":",
... | // setMacVlanMode setter for one of the four macvlan port types | [
"setMacVlanMode",
"setter",
"for",
"one",
"of",
"the",
"four",
"macvlan",
"port",
"types"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_setup.go#L52-L65 |
22,518 | docker/libnetwork | drivers/macvlan/macvlan_setup.go | delVlanLink | func delVlanLink(linkName string) error {
if strings.Contains(linkName, ".") {
_, _, err := parseVlan(linkName)
if err != nil {
return err
}
// delete the vlan subinterface
vlanLink, err := ns.NlHandle().LinkByName(linkName)
if err != nil {
return fmt.Errorf("failed to find interface %s on the Docker... | go | func delVlanLink(linkName string) error {
if strings.Contains(linkName, ".") {
_, _, err := parseVlan(linkName)
if err != nil {
return err
}
// delete the vlan subinterface
vlanLink, err := ns.NlHandle().LinkByName(linkName)
if err != nil {
return fmt.Errorf("failed to find interface %s on the Docker... | [
"func",
"delVlanLink",
"(",
"linkName",
"string",
")",
"error",
"{",
"if",
"strings",
".",
"Contains",
"(",
"linkName",
",",
"\"",
"\"",
")",
"{",
"_",
",",
"_",
",",
"err",
":=",
"parseVlan",
"(",
"linkName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"... | // delVlanLink verifies only sub-interfaces with a vlan id get deleted | [
"delVlanLink",
"verifies",
"only",
"sub",
"-",
"interfaces",
"with",
"a",
"vlan",
"id",
"get",
"deleted"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_setup.go#L116-L140 |
22,519 | docker/libnetwork | resolvconf/resolvconf.go | GetSpecific | func GetSpecific(path string) (*File, error) {
resolv, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
hash, err := ioutils.HashData(bytes.NewReader(resolv))
if err != nil {
return nil, err
}
return &File{Content: resolv, Hash: hash}, nil
} | go | func GetSpecific(path string) (*File, error) {
resolv, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
hash, err := ioutils.HashData(bytes.NewReader(resolv))
if err != nil {
return nil, err
}
return &File{Content: resolv, Hash: hash}, nil
} | [
"func",
"GetSpecific",
"(",
"path",
"string",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"resolv",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n... | // GetSpecific returns the contents of the user specified resolv.conf file and its hash | [
"GetSpecific",
"returns",
"the",
"contents",
"of",
"the",
"user",
"specified",
"resolv",
".",
"conf",
"file",
"and",
"its",
"hash"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L62-L72 |
22,520 | docker/libnetwork | resolvconf/resolvconf.go | GetLastModified | func GetLastModified() *File {
lastModified.Lock()
defer lastModified.Unlock()
return &File{Content: lastModified.contents, Hash: lastModified.sha256}
} | go | func GetLastModified() *File {
lastModified.Lock()
defer lastModified.Unlock()
return &File{Content: lastModified.contents, Hash: lastModified.sha256}
} | [
"func",
"GetLastModified",
"(",
")",
"*",
"File",
"{",
"lastModified",
".",
"Lock",
"(",
")",
"\n",
"defer",
"lastModified",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"&",
"File",
"{",
"Content",
":",
"lastModified",
".",
"contents",
",",
"Hash",
":",
... | // GetLastModified retrieves the last used contents and hash of the host resolv.conf.
// Used by containers updating on restart | [
"GetLastModified",
"retrieves",
"the",
"last",
"used",
"contents",
"and",
"hash",
"of",
"the",
"host",
"resolv",
".",
"conf",
".",
"Used",
"by",
"containers",
"updating",
"on",
"restart"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L100-L105 |
22,521 | docker/libnetwork | resolvconf/resolvconf.go | getLines | func getLines(input []byte, commentMarker []byte) [][]byte {
lines := bytes.Split(input, []byte("\n"))
var output [][]byte
for _, currentLine := range lines {
var commentIndex = bytes.Index(currentLine, commentMarker)
if commentIndex == -1 {
output = append(output, currentLine)
} else {
output = append(o... | go | func getLines(input []byte, commentMarker []byte) [][]byte {
lines := bytes.Split(input, []byte("\n"))
var output [][]byte
for _, currentLine := range lines {
var commentIndex = bytes.Index(currentLine, commentMarker)
if commentIndex == -1 {
output = append(output, currentLine)
} else {
output = append(o... | [
"func",
"getLines",
"(",
"input",
"[",
"]",
"byte",
",",
"commentMarker",
"[",
"]",
"byte",
")",
"[",
"]",
"[",
"]",
"byte",
"{",
"lines",
":=",
"bytes",
".",
"Split",
"(",
"input",
",",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
")",
"\n",... | // getLines parses input into lines and strips away comments. | [
"getLines",
"parses",
"input",
"into",
"lines",
"and",
"strips",
"away",
"comments",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L139-L151 |
22,522 | docker/libnetwork | resolvconf/resolvconf.go | Build | func Build(path string, dns, dnsSearch, dnsOptions []string) (*File, error) {
content := bytes.NewBuffer(nil)
if len(dnsSearch) > 0 {
if searchString := strings.Join(dnsSearch, " "); strings.Trim(searchString, " ") != "." {
if _, err := content.WriteString("search " + searchString + "\n"); err != nil {
retur... | go | func Build(path string, dns, dnsSearch, dnsOptions []string) (*File, error) {
content := bytes.NewBuffer(nil)
if len(dnsSearch) > 0 {
if searchString := strings.Join(dnsSearch, " "); strings.Trim(searchString, " ") != "." {
if _, err := content.WriteString("search " + searchString + "\n"); err != nil {
retur... | [
"func",
"Build",
"(",
"path",
"string",
",",
"dns",
",",
"dnsSearch",
",",
"dnsOptions",
"[",
"]",
"string",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"content",
":=",
"bytes",
".",
"NewBuffer",
"(",
"nil",
")",
"\n",
"if",
"len",
"(",
"dnsSea... | // Build writes a configuration file to path containing a "nameserver" entry
// for every element in dns, a "search" entry for every element in
// dnsSearch, and an "options" entry for every element in dnsOptions. | [
"Build",
"writes",
"a",
"configuration",
"file",
"to",
"path",
"containing",
"a",
"nameserver",
"entry",
"for",
"every",
"element",
"in",
"dns",
"a",
"search",
"entry",
"for",
"every",
"element",
"in",
"dnsSearch",
"and",
"an",
"options",
"entry",
"for",
"ev... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolvconf/resolvconf.go#L223-L251 |
22,523 | docker/libnetwork | ipam/allocator.go | NewAllocator | func NewAllocator(lcDs, glDs datastore.DataStore) (*Allocator, error) {
a := &Allocator{}
// Load predefined subnet pools
a.predefined = map[string][]*net.IPNet{
localAddressSpace: ipamutils.GetLocalScopeDefaultNetworks(),
globalAddressSpace: ipamutils.GetGlobalScopeDefaultNetworks(),
}
// Initialize asInd... | go | func NewAllocator(lcDs, glDs datastore.DataStore) (*Allocator, error) {
a := &Allocator{}
// Load predefined subnet pools
a.predefined = map[string][]*net.IPNet{
localAddressSpace: ipamutils.GetLocalScopeDefaultNetworks(),
globalAddressSpace: ipamutils.GetGlobalScopeDefaultNetworks(),
}
// Initialize asInd... | [
"func",
"NewAllocator",
"(",
"lcDs",
",",
"glDs",
"datastore",
".",
"DataStore",
")",
"(",
"*",
"Allocator",
",",
"error",
")",
"{",
"a",
":=",
"&",
"Allocator",
"{",
"}",
"\n\n",
"// Load predefined subnet pools",
"a",
".",
"predefined",
"=",
"map",
"[",
... | // NewAllocator returns an instance of libnetwork ipam | [
"NewAllocator",
"returns",
"an",
"instance",
"of",
"libnetwork",
"ipam"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L44-L73 |
22,524 | docker/libnetwork | ipam/allocator.go | checkConsistency | func (a *Allocator) checkConsistency(as string) {
var sKeyList []SubnetKey
// Retrieve this address space's configuration and bitmasks from the datastore
a.refresh(as)
a.Lock()
aSpace, ok := a.addrSpaces[as]
a.Unlock()
if !ok {
return
}
a.updateBitMasks(aSpace)
aSpace.Lock()
for sk, pd := range aSpace.su... | go | func (a *Allocator) checkConsistency(as string) {
var sKeyList []SubnetKey
// Retrieve this address space's configuration and bitmasks from the datastore
a.refresh(as)
a.Lock()
aSpace, ok := a.addrSpaces[as]
a.Unlock()
if !ok {
return
}
a.updateBitMasks(aSpace)
aSpace.Lock()
for sk, pd := range aSpace.su... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"checkConsistency",
"(",
"as",
"string",
")",
"{",
"var",
"sKeyList",
"[",
"]",
"SubnetKey",
"\n\n",
"// Retrieve this address space's configuration and bitmasks from the datastore",
"a",
".",
"refresh",
"(",
"as",
")",
"\n",... | // Checks for and fixes damaged bitmask. | [
"Checks",
"for",
"and",
"fixes",
"damaged",
"bitmask",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L118-L148 |
22,525 | docker/libnetwork | ipam/allocator.go | DiscoverNew | func (a *Allocator) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
if dType != discoverapi.DatastoreConfig {
return nil
}
dsc, ok := data.(discoverapi.DatastoreConfigData)
if !ok {
return types.InternalErrorf("incorrect data in datastore update notification: %v", data)
}
ds, err := d... | go | func (a *Allocator) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
if dType != discoverapi.DatastoreConfig {
return nil
}
dsc, ok := data.(discoverapi.DatastoreConfigData)
if !ok {
return types.InternalErrorf("incorrect data in datastore update notification: %v", data)
}
ds, err := d... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"DiscoverNew",
"(",
"dType",
"discoverapi",
".",
"DiscoveryType",
",",
"data",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"dType",
"!=",
"discoverapi",
".",
"DatastoreConfig",
"{",
"return",
"nil",
"\n",
"}",
... | // DiscoverNew informs the allocator about a new global scope datastore | [
"DiscoverNew",
"informs",
"the",
"allocator",
"about",
"a",
"new",
"global",
"scope",
"datastore"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L178-L194 |
22,526 | docker/libnetwork | ipam/allocator.go | RequestPool | func (a *Allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {
logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
k, nw, ipr, err := a.parsePoolRequest(addressSpace, pool, subPool, v6)
i... | go | func (a *Allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {
logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
k, nw, ipr, err := a.parsePoolRequest(addressSpace, pool, subPool, v6)
i... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"RequestPool",
"(",
"addressSpace",
",",
"pool",
",",
"subPool",
"string",
",",
"options",
"map",
"[",
"string",
"]",
"string",
",",
"v6",
"bool",
")",
"(",
"string",
",",
"*",
"net",
".",
"IPNet",
",",
"map",... | // RequestPool returns an address pool along with its unique id.
// addressSpace must be a valid address space name and must not be the empty string.
// If pool is the empty string then the default predefined pool for addressSpace will be used, otherwise pool must be a valid IP address and length in CIDR notation.
// I... | [
"RequestPool",
"returns",
"an",
"address",
"pool",
"along",
"with",
"its",
"unique",
"id",
".",
"addressSpace",
"must",
"be",
"a",
"valid",
"address",
"space",
"name",
"and",
"must",
"not",
"be",
"the",
"empty",
"string",
".",
"If",
"pool",
"is",
"the",
... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L211-L256 |
22,527 | docker/libnetwork | ipam/allocator.go | ReleasePool | func (a *Allocator) ReleasePool(poolID string) error {
logrus.Debugf("ReleasePool(%s)", poolID)
k := SubnetKey{}
if err := k.FromString(poolID); err != nil {
return types.BadRequestErrorf("invalid pool id: %s", poolID)
}
retry:
if err := a.refresh(k.AddressSpace); err != nil {
return err
}
aSpace, err := a... | go | func (a *Allocator) ReleasePool(poolID string) error {
logrus.Debugf("ReleasePool(%s)", poolID)
k := SubnetKey{}
if err := k.FromString(poolID); err != nil {
return types.BadRequestErrorf("invalid pool id: %s", poolID)
}
retry:
if err := a.refresh(k.AddressSpace); err != nil {
return err
}
aSpace, err := a... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"ReleasePool",
"(",
"poolID",
"string",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"poolID",
")",
"\n",
"k",
":=",
"SubnetKey",
"{",
"}",
"\n",
"if",
"err",
":=",
"k",
".",
"FromString... | // ReleasePool releases the address pool identified by the passed id | [
"ReleasePool",
"releases",
"the",
"address",
"pool",
"identified",
"by",
"the",
"passed",
"id"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L259-L289 |
22,528 | docker/libnetwork | ipam/allocator.go | getAddrSpace | func (a *Allocator) getAddrSpace(as string) (*addrSpace, error) {
a.Lock()
defer a.Unlock()
aSpace, ok := a.addrSpaces[as]
if !ok {
return nil, types.BadRequestErrorf("cannot find address space %s (most likely the backing datastore is not configured)", as)
}
return aSpace, nil
} | go | func (a *Allocator) getAddrSpace(as string) (*addrSpace, error) {
a.Lock()
defer a.Unlock()
aSpace, ok := a.addrSpaces[as]
if !ok {
return nil, types.BadRequestErrorf("cannot find address space %s (most likely the backing datastore is not configured)", as)
}
return aSpace, nil
} | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"getAddrSpace",
"(",
"as",
"string",
")",
"(",
"*",
"addrSpace",
",",
"error",
")",
"{",
"a",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"Unlock",
"(",
")",
"\n",
"aSpace",
",",
"ok",
":=",
"a",
"."... | // Given the address space, returns the local or global PoolConfig based on whether the
// address space is local or global. AddressSpace locality is registered with IPAM out of band. | [
"Given",
"the",
"address",
"space",
"returns",
"the",
"local",
"or",
"global",
"PoolConfig",
"based",
"on",
"whether",
"the",
"address",
"space",
"is",
"local",
"or",
"global",
".",
"AddressSpace",
"locality",
"is",
"registered",
"with",
"IPAM",
"out",
"of",
... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L293-L301 |
22,529 | docker/libnetwork | ipam/allocator.go | parsePoolRequest | func (a *Allocator) parsePoolRequest(addressSpace, pool, subPool string, v6 bool) (*SubnetKey, *net.IPNet, *AddressRange, error) {
var (
nw *net.IPNet
ipr *AddressRange
err error
)
if addressSpace == "" {
return nil, nil, nil, ipamapi.ErrInvalidAddressSpace
}
if pool == "" && subPool != "" {
return ni... | go | func (a *Allocator) parsePoolRequest(addressSpace, pool, subPool string, v6 bool) (*SubnetKey, *net.IPNet, *AddressRange, error) {
var (
nw *net.IPNet
ipr *AddressRange
err error
)
if addressSpace == "" {
return nil, nil, nil, ipamapi.ErrInvalidAddressSpace
}
if pool == "" && subPool != "" {
return ni... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"parsePoolRequest",
"(",
"addressSpace",
",",
"pool",
",",
"subPool",
"string",
",",
"v6",
"bool",
")",
"(",
"*",
"SubnetKey",
",",
"*",
"net",
".",
"IPNet",
",",
"*",
"AddressRange",
",",
"error",
")",
"{",
"... | // parsePoolRequest parses and validates a request to create a new pool under addressSpace and returns
// a SubnetKey, network and range describing the request. | [
"parsePoolRequest",
"parses",
"and",
"validates",
"a",
"request",
"to",
"create",
"a",
"new",
"pool",
"under",
"addressSpace",
"and",
"returns",
"a",
"SubnetKey",
"network",
"and",
"range",
"describing",
"the",
"request",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L305-L335 |
22,530 | docker/libnetwork | ipam/allocator.go | RequestAddress | func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) {
logrus.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
k := SubnetKey{}
if err := k.FromString(poolID); err != nil {
return nil, nil, types.BadRequestErrorf("invali... | go | func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) {
logrus.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
k := SubnetKey{}
if err := k.FromString(poolID); err != nil {
return nil, nil, types.BadRequestErrorf("invali... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"RequestAddress",
"(",
"poolID",
"string",
",",
"prefAddress",
"net",
".",
"IP",
",",
"opts",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"net",
".",
"IPNet",
",",
"map",
"[",
"string",
"]",
"string",
... | // RequestAddress returns an address from the specified pool ID | [
"RequestAddress",
"returns",
"an",
"address",
"from",
"the",
"specified",
"pool",
"ID"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L451-L505 |
22,531 | docker/libnetwork | ipam/allocator.go | ReleaseAddress | func (a *Allocator) ReleaseAddress(poolID string, address net.IP) error {
logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address)
k := SubnetKey{}
if err := k.FromString(poolID); err != nil {
return types.BadRequestErrorf("invalid pool id: %s", poolID)
}
if err := a.refresh(k.AddressSpace); err != nil {
retu... | go | func (a *Allocator) ReleaseAddress(poolID string, address net.IP) error {
logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address)
k := SubnetKey{}
if err := k.FromString(poolID); err != nil {
return types.BadRequestErrorf("invalid pool id: %s", poolID)
}
if err := a.refresh(k.AddressSpace); err != nil {
retu... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"ReleaseAddress",
"(",
"poolID",
"string",
",",
"address",
"net",
".",
"IP",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"poolID",
",",
"address",
")",
"\n",
"k",
":=",
"SubnetKey",
"{",
... | // ReleaseAddress releases the address from the specified pool ID | [
"ReleaseAddress",
"releases",
"the",
"address",
"from",
"the",
"specified",
"pool",
"ID"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L508-L563 |
22,532 | docker/libnetwork | ipam/allocator.go | DumpDatabase | func (a *Allocator) DumpDatabase() string {
a.Lock()
aspaces := make(map[string]*addrSpace, len(a.addrSpaces))
orderedAS := make([]string, 0, len(a.addrSpaces))
for as, aSpace := range a.addrSpaces {
orderedAS = append(orderedAS, as)
aspaces[as] = aSpace
}
a.Unlock()
sort.Strings(orderedAS)
var s string
... | go | func (a *Allocator) DumpDatabase() string {
a.Lock()
aspaces := make(map[string]*addrSpace, len(a.addrSpaces))
orderedAS := make([]string, 0, len(a.addrSpaces))
for as, aSpace := range a.addrSpaces {
orderedAS = append(orderedAS, as)
aspaces[as] = aSpace
}
a.Unlock()
sort.Strings(orderedAS)
var s string
... | [
"func",
"(",
"a",
"*",
"Allocator",
")",
"DumpDatabase",
"(",
")",
"string",
"{",
"a",
".",
"Lock",
"(",
")",
"\n",
"aspaces",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"addrSpace",
",",
"len",
"(",
"a",
".",
"addrSpaces",
")",
")",
"\n"... | // DumpDatabase dumps the internal info | [
"DumpDatabase",
"dumps",
"the",
"internal",
"info"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/allocator.go#L605-L637 |
22,533 | docker/libnetwork | service_linux.go | populateLoadBalancers | func (sb *sandbox) populateLoadBalancers(ep *endpoint) {
// This is an interface less endpoint. Nothing to do.
if ep.Iface() == nil {
return
}
n := ep.getNetwork()
eIP := ep.Iface().Address()
if n.ingress {
if err := addRedirectRules(sb.Key(), eIP, ep.ingressPorts); err != nil {
logrus.Errorf("Failed to ... | go | func (sb *sandbox) populateLoadBalancers(ep *endpoint) {
// This is an interface less endpoint. Nothing to do.
if ep.Iface() == nil {
return
}
n := ep.getNetwork()
eIP := ep.Iface().Address()
if n.ingress {
if err := addRedirectRules(sb.Key(), eIP, ep.ingressPorts); err != nil {
logrus.Errorf("Failed to ... | [
"func",
"(",
"sb",
"*",
"sandbox",
")",
"populateLoadBalancers",
"(",
"ep",
"*",
"endpoint",
")",
"{",
"// This is an interface less endpoint. Nothing to do.",
"if",
"ep",
".",
"Iface",
"(",
")",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"n",
":=",
"ep"... | // Populate all loadbalancers on the network that the passed endpoint
// belongs to, into this sandbox. | [
"Populate",
"all",
"loadbalancers",
"on",
"the",
"network",
"that",
"the",
"passed",
"endpoint",
"belongs",
"to",
"into",
"this",
"sandbox",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service_linux.go#L35-L49 |
22,534 | docker/libnetwork | service_linux.go | invokeFWMarker | func invokeFWMarker(path string, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, isDelete bool, lbMode string) error {
var ingressPortsFile string
if len(ingressPorts) != 0 {
var err error
ingressPortsFile, err = writePortsToFile(ingressPorts)
if err != nil {
return err
}
defer o... | go | func invokeFWMarker(path string, vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, isDelete bool, lbMode string) error {
var ingressPortsFile string
if len(ingressPorts) != 0 {
var err error
ingressPortsFile, err = writePortsToFile(ingressPorts)
if err != nil {
return err
}
defer o... | [
"func",
"invokeFWMarker",
"(",
"path",
"string",
",",
"vip",
"net",
".",
"IP",
",",
"fwMark",
"uint32",
",",
"ingressPorts",
"[",
"]",
"*",
"PortConfig",
",",
"eIP",
"*",
"net",
".",
"IPNet",
",",
"isDelete",
"bool",
",",
"lbMode",
"string",
")",
"erro... | // Invoke fwmarker reexec routine to mark vip destined packets with
// the passed firewall mark. | [
"Invoke",
"fwmarker",
"reexec",
"routine",
"to",
"mark",
"vip",
"destined",
"packets",
"with",
"the",
"passed",
"firewall",
"mark",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service_linux.go#L575-L605 |
22,535 | docker/libnetwork | drivers/windows/windows.go | IsBuiltinLocalDriver | func IsBuiltinLocalDriver(networkType string) bool {
if "l2bridge" == networkType || "l2tunnel" == networkType || "nat" == networkType || "ics" == networkType || "transparent" == networkType {
return true
}
return false
} | go | func IsBuiltinLocalDriver(networkType string) bool {
if "l2bridge" == networkType || "l2tunnel" == networkType || "nat" == networkType || "ics" == networkType || "transparent" == networkType {
return true
}
return false
} | [
"func",
"IsBuiltinLocalDriver",
"(",
"networkType",
"string",
")",
"bool",
"{",
"if",
"\"",
"\"",
"==",
"networkType",
"||",
"\"",
"\"",
"==",
"networkType",
"||",
"\"",
"\"",
"==",
"networkType",
"||",
"\"",
"\"",
"==",
"networkType",
"||",
"\"",
"\"",
... | // IsBuiltinLocalDriver validates if network-type is a builtin local-scoped driver | [
"IsBuiltinLocalDriver",
"validates",
"if",
"network",
"-",
"type",
"is",
"a",
"builtin",
"local",
"-",
"scoped",
"driver"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L113-L119 |
22,536 | docker/libnetwork | drivers/windows/windows.go | newDriver | func newDriver(networkType string) *driver {
return &driver{name: networkType, networks: map[string]*hnsNetwork{}}
} | go | func newDriver(networkType string) *driver {
return &driver{name: networkType, networks: map[string]*hnsNetwork{}}
} | [
"func",
"newDriver",
"(",
"networkType",
"string",
")",
"*",
"driver",
"{",
"return",
"&",
"driver",
"{",
"name",
":",
"networkType",
",",
"networks",
":",
"map",
"[",
"string",
"]",
"*",
"hnsNetwork",
"{",
"}",
"}",
"\n",
"}"
] | // New constructs a new bridge driver | [
"New",
"constructs",
"a",
"new",
"bridge",
"driver"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L122-L124 |
22,537 | docker/libnetwork | drivers/windows/windows.go | GetInit | func GetInit(networkType string) func(dc driverapi.DriverCallback, config map[string]interface{}) error {
return func(dc driverapi.DriverCallback, config map[string]interface{}) error {
if !IsBuiltinLocalDriver(networkType) {
return types.BadRequestErrorf("Network type not supported: %s", networkType)
}
d :=... | go | func GetInit(networkType string) func(dc driverapi.DriverCallback, config map[string]interface{}) error {
return func(dc driverapi.DriverCallback, config map[string]interface{}) error {
if !IsBuiltinLocalDriver(networkType) {
return types.BadRequestErrorf("Network type not supported: %s", networkType)
}
d :=... | [
"func",
"GetInit",
"(",
"networkType",
"string",
")",
"func",
"(",
"dc",
"driverapi",
".",
"DriverCallback",
",",
"config",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"func",
"(",
"dc",
"driverapi",
".",
"DriverCallback"... | // GetInit returns an initializer for the given network type | [
"GetInit",
"returns",
"an",
"initializer",
"for",
"the",
"given",
"network",
"type"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L127-L145 |
22,538 | docker/libnetwork | drivers/windows/windows.go | ConvertPortBindings | func ConvertPortBindings(portBindings []types.PortBinding) ([]json.RawMessage, error) {
var pbs []json.RawMessage
// Enumerate through the port bindings specified by the user and convert
// them into the internal structure matching the JSON blob that can be
// understood by the HCS.
for _, elem := range portBindi... | go | func ConvertPortBindings(portBindings []types.PortBinding) ([]json.RawMessage, error) {
var pbs []json.RawMessage
// Enumerate through the port bindings specified by the user and convert
// them into the internal structure matching the JSON blob that can be
// understood by the HCS.
for _, elem := range portBindi... | [
"func",
"ConvertPortBindings",
"(",
"portBindings",
"[",
"]",
"types",
".",
"PortBinding",
")",
"(",
"[",
"]",
"json",
".",
"RawMessage",
",",
"error",
")",
"{",
"var",
"pbs",
"[",
"]",
"json",
".",
"RawMessage",
"\n\n",
"// Enumerate through the port bindings... | // ConvertPortBindings converts PortBindings to JSON for HNS request | [
"ConvertPortBindings",
"converts",
"PortBindings",
"to",
"JSON",
"for",
"HNS",
"request"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L449-L482 |
22,539 | docker/libnetwork | drivers/windows/windows.go | ParsePortBindingPolicies | func ParsePortBindingPolicies(policies []json.RawMessage) ([]types.PortBinding, error) {
var bindings []types.PortBinding
hcsPolicy := &hcsshim.NatPolicy{}
for _, elem := range policies {
if err := json.Unmarshal([]byte(elem), &hcsPolicy); err != nil || hcsPolicy.Type != "NAT" {
continue
}
binding := typ... | go | func ParsePortBindingPolicies(policies []json.RawMessage) ([]types.PortBinding, error) {
var bindings []types.PortBinding
hcsPolicy := &hcsshim.NatPolicy{}
for _, elem := range policies {
if err := json.Unmarshal([]byte(elem), &hcsPolicy); err != nil || hcsPolicy.Type != "NAT" {
continue
}
binding := typ... | [
"func",
"ParsePortBindingPolicies",
"(",
"policies",
"[",
"]",
"json",
".",
"RawMessage",
")",
"(",
"[",
"]",
"types",
".",
"PortBinding",
",",
"error",
")",
"{",
"var",
"bindings",
"[",
"]",
"types",
".",
"PortBinding",
"\n",
"hcsPolicy",
":=",
"&",
"hc... | // ParsePortBindingPolicies parses HNS endpoint response message to PortBindings | [
"ParsePortBindingPolicies",
"parses",
"HNS",
"endpoint",
"response",
"message",
"to",
"PortBindings"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L485-L507 |
22,540 | docker/libnetwork | drivers/windows/windows.go | ParseEndpointConnectivity | func ParseEndpointConnectivity(epOptions map[string]interface{}) (*EndpointConnectivity, error) {
if epOptions == nil {
return nil, nil
}
ec := &EndpointConnectivity{}
if opt, ok := epOptions[netlabel.PortMap]; ok {
if bs, ok := opt.([]types.PortBinding); ok {
ec.PortBindings = bs
} else {
return nil,... | go | func ParseEndpointConnectivity(epOptions map[string]interface{}) (*EndpointConnectivity, error) {
if epOptions == nil {
return nil, nil
}
ec := &EndpointConnectivity{}
if opt, ok := epOptions[netlabel.PortMap]; ok {
if bs, ok := opt.([]types.PortBinding); ok {
ec.PortBindings = bs
} else {
return nil,... | [
"func",
"ParseEndpointConnectivity",
"(",
"epOptions",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"*",
"EndpointConnectivity",
",",
"error",
")",
"{",
"if",
"epOptions",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"... | // ParseEndpointConnectivity parses options passed to CreateEndpoint, specifically port bindings, and store in a endpointConnectivity object. | [
"ParseEndpointConnectivity",
"parses",
"options",
"passed",
"to",
"CreateEndpoint",
"specifically",
"port",
"bindings",
"and",
"store",
"in",
"a",
"endpointConnectivity",
"object",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/windows.go#L560-L583 |
22,541 | docker/libnetwork | service_common.go | cleanupServiceDiscovery | func (c *controller) cleanupServiceDiscovery(cleanupNID string) {
c.Lock()
defer c.Unlock()
if cleanupNID == "" {
logrus.Debugf("cleanupServiceDiscovery for all networks")
c.svcRecords = make(map[string]svcInfo)
return
}
logrus.Debugf("cleanupServiceDiscovery for network:%s", cleanupNID)
delete(c.svcRecords... | go | func (c *controller) cleanupServiceDiscovery(cleanupNID string) {
c.Lock()
defer c.Unlock()
if cleanupNID == "" {
logrus.Debugf("cleanupServiceDiscovery for all networks")
c.svcRecords = make(map[string]svcInfo)
return
}
logrus.Debugf("cleanupServiceDiscovery for network:%s", cleanupNID)
delete(c.svcRecords... | [
"func",
"(",
"c",
"*",
"controller",
")",
"cleanupServiceDiscovery",
"(",
"cleanupNID",
"string",
")",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"if",
"cleanupNID",
"==",
"\"",
"\"",
"{",
"logrus",
".",
"Debu... | // cleanupServiceDiscovery when the network is being deleted, erase all the associated service discovery records | [
"cleanupServiceDiscovery",
"when",
"the",
"network",
"is",
"being",
"deleted",
"erase",
"all",
"the",
"associated",
"service",
"discovery",
"records"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service_common.go#L167-L177 |
22,542 | docker/libnetwork | drivers/bridge/setup_bridgenetfiltering.go | getKernelBoolParam | func getKernelBoolParam(path string) (bool, error) {
enabled := false
line, err := ioutil.ReadFile(path)
if err != nil {
return false, err
}
if len(line) > 0 {
enabled = line[0] == '1'
}
return enabled, err
} | go | func getKernelBoolParam(path string) (bool, error) {
enabled := false
line, err := ioutil.ReadFile(path)
if err != nil {
return false, err
}
if len(line) > 0 {
enabled = line[0] == '1'
}
return enabled, err
} | [
"func",
"getKernelBoolParam",
"(",
"path",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"enabled",
":=",
"false",
"\n",
"line",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fals... | //Gets the value of the kernel parameters located at the given path | [
"Gets",
"the",
"value",
"of",
"the",
"kernel",
"parameters",
"located",
"at",
"the",
"given",
"path"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_bridgenetfiltering.go#L123-L133 |
22,543 | docker/libnetwork | drivers/bridge/setup_bridgenetfiltering.go | setKernelBoolParam | func setKernelBoolParam(path string, on bool) error {
value := byte('0')
if on {
value = byte('1')
}
return ioutil.WriteFile(path, []byte{value, '\n'}, 0644)
} | go | func setKernelBoolParam(path string, on bool) error {
value := byte('0')
if on {
value = byte('1')
}
return ioutil.WriteFile(path, []byte{value, '\n'}, 0644)
} | [
"func",
"setKernelBoolParam",
"(",
"path",
"string",
",",
"on",
"bool",
")",
"error",
"{",
"value",
":=",
"byte",
"(",
"'0'",
")",
"\n",
"if",
"on",
"{",
"value",
"=",
"byte",
"(",
"'1'",
")",
"\n",
"}",
"\n",
"return",
"ioutil",
".",
"WriteFile",
... | //Sets the value of the kernel parameter located at the given path | [
"Sets",
"the",
"value",
"of",
"the",
"kernel",
"parameter",
"located",
"at",
"the",
"given",
"path"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_bridgenetfiltering.go#L136-L142 |
22,544 | docker/libnetwork | drivers/bridge/setup_bridgenetfiltering.go | isPacketForwardingEnabled | func isPacketForwardingEnabled(ipVer ipVersion, iface string) (bool, error) {
switch ipVer {
case ipv4, ipv6:
return getKernelBoolParam(getForwardingKernelParam(ipVer, iface))
case ipvboth:
enabled, err := getKernelBoolParam(getForwardingKernelParam(ipv4, ""))
if err != nil || !enabled {
return enabled, err... | go | func isPacketForwardingEnabled(ipVer ipVersion, iface string) (bool, error) {
switch ipVer {
case ipv4, ipv6:
return getKernelBoolParam(getForwardingKernelParam(ipVer, iface))
case ipvboth:
enabled, err := getKernelBoolParam(getForwardingKernelParam(ipv4, ""))
if err != nil || !enabled {
return enabled, err... | [
"func",
"isPacketForwardingEnabled",
"(",
"ipVer",
"ipVersion",
",",
"iface",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"switch",
"ipVer",
"{",
"case",
"ipv4",
",",
"ipv6",
":",
"return",
"getKernelBoolParam",
"(",
"getForwardingKernelParam",
"(",
"i... | //Checks to see if packet forwarding is enabled | [
"Checks",
"to",
"see",
"if",
"packet",
"forwarding",
"is",
"enabled"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/setup_bridgenetfiltering.go#L145-L158 |
22,545 | docker/libnetwork | endpoint.go | isServiceEnabled | func (ep *endpoint) isServiceEnabled() bool {
ep.Lock()
defer ep.Unlock()
return ep.serviceEnabled
} | go | func (ep *endpoint) isServiceEnabled() bool {
ep.Lock()
defer ep.Unlock()
return ep.serviceEnabled
} | [
"func",
"(",
"ep",
"*",
"endpoint",
")",
"isServiceEnabled",
"(",
")",
"bool",
"{",
"ep",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ep",
".",
"Unlock",
"(",
")",
"\n",
"return",
"ep",
".",
"serviceEnabled",
"\n",
"}"
] | // isServiceEnabled check if service is enabled on the endpoint | [
"isServiceEnabled",
"check",
"if",
"service",
"is",
"enabled",
"on",
"the",
"endpoint"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L314-L318 |
22,546 | docker/libnetwork | endpoint.go | enableService | func (ep *endpoint) enableService() {
ep.Lock()
defer ep.Unlock()
ep.serviceEnabled = true
} | go | func (ep *endpoint) enableService() {
ep.Lock()
defer ep.Unlock()
ep.serviceEnabled = true
} | [
"func",
"(",
"ep",
"*",
"endpoint",
")",
"enableService",
"(",
")",
"{",
"ep",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ep",
".",
"Unlock",
"(",
")",
"\n",
"ep",
".",
"serviceEnabled",
"=",
"true",
"\n",
"}"
] | // enableService sets service enabled on the endpoint | [
"enableService",
"sets",
"service",
"enabled",
"on",
"the",
"endpoint"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L321-L325 |
22,547 | docker/libnetwork | endpoint.go | disableService | func (ep *endpoint) disableService() {
ep.Lock()
defer ep.Unlock()
ep.serviceEnabled = false
} | go | func (ep *endpoint) disableService() {
ep.Lock()
defer ep.Unlock()
ep.serviceEnabled = false
} | [
"func",
"(",
"ep",
"*",
"endpoint",
")",
"disableService",
"(",
")",
"{",
"ep",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ep",
".",
"Unlock",
"(",
")",
"\n",
"ep",
".",
"serviceEnabled",
"=",
"false",
"\n",
"}"
] | // disableService disables service on the endpoint | [
"disableService",
"disables",
"service",
"on",
"the",
"endpoint"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L328-L332 |
22,548 | docker/libnetwork | endpoint.go | EndpointOptionGeneric | func EndpointOptionGeneric(generic map[string]interface{}) EndpointOption {
return func(ep *endpoint) {
for k, v := range generic {
ep.generic[k] = v
}
}
} | go | func EndpointOptionGeneric(generic map[string]interface{}) EndpointOption {
return func(ep *endpoint) {
for k, v := range generic {
ep.generic[k] = v
}
}
} | [
"func",
"EndpointOptionGeneric",
"(",
"generic",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"EndpointOption",
"{",
"return",
"func",
"(",
"ep",
"*",
"endpoint",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"generic",
"{",
"ep",
".",
"gene... | // EndpointOptionGeneric function returns an option setter for a Generic option defined
// in a Dictionary of Key-Value pair | [
"EndpointOptionGeneric",
"function",
"returns",
"an",
"option",
"setter",
"for",
"a",
"Generic",
"option",
"defined",
"in",
"a",
"Dictionary",
"of",
"Key",
"-",
"Value",
"pair"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L928-L934 |
22,549 | docker/libnetwork | endpoint.go | CreateOptionIpam | func CreateOptionIpam(ipV4, ipV6 net.IP, llIPs []net.IP, ipamOptions map[string]string) EndpointOption {
return func(ep *endpoint) {
ep.prefAddress = ipV4
ep.prefAddressV6 = ipV6
if len(llIPs) != 0 {
for _, ip := range llIPs {
nw := &net.IPNet{IP: ip, Mask: linkLocalMask}
if ip.To4() == nil {
nw.... | go | func CreateOptionIpam(ipV4, ipV6 net.IP, llIPs []net.IP, ipamOptions map[string]string) EndpointOption {
return func(ep *endpoint) {
ep.prefAddress = ipV4
ep.prefAddressV6 = ipV6
if len(llIPs) != 0 {
for _, ip := range llIPs {
nw := &net.IPNet{IP: ip, Mask: linkLocalMask}
if ip.To4() == nil {
nw.... | [
"func",
"CreateOptionIpam",
"(",
"ipV4",
",",
"ipV6",
"net",
".",
"IP",
",",
"llIPs",
"[",
"]",
"net",
".",
"IP",
",",
"ipamOptions",
"map",
"[",
"string",
"]",
"string",
")",
"EndpointOption",
"{",
"return",
"func",
"(",
"ep",
"*",
"endpoint",
")",
... | // CreateOptionIpam function returns an option setter for the ipam configuration for this endpoint | [
"CreateOptionIpam",
"function",
"returns",
"an",
"option",
"setter",
"for",
"the",
"ipam",
"configuration",
"for",
"this",
"endpoint"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L942-L957 |
22,550 | docker/libnetwork | endpoint.go | CreateOptionDNS | func CreateOptionDNS(dns []string) EndpointOption {
return func(ep *endpoint) {
ep.generic[netlabel.DNSServers] = dns
}
} | go | func CreateOptionDNS(dns []string) EndpointOption {
return func(ep *endpoint) {
ep.generic[netlabel.DNSServers] = dns
}
} | [
"func",
"CreateOptionDNS",
"(",
"dns",
"[",
"]",
"string",
")",
"EndpointOption",
"{",
"return",
"func",
"(",
"ep",
"*",
"endpoint",
")",
"{",
"ep",
".",
"generic",
"[",
"netlabel",
".",
"DNSServers",
"]",
"=",
"dns",
"\n",
"}",
"\n",
"}"
] | // CreateOptionDNS function returns an option setter for dns entry option to
// be passed to container Create method. | [
"CreateOptionDNS",
"function",
"returns",
"an",
"option",
"setter",
"for",
"dns",
"entry",
"option",
"to",
"be",
"passed",
"to",
"container",
"Create",
"method",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L985-L989 |
22,551 | docker/libnetwork | endpoint.go | CreateOptionAlias | func CreateOptionAlias(name string, alias string) EndpointOption {
return func(ep *endpoint) {
if ep.aliases == nil {
ep.aliases = make(map[string]string)
}
ep.aliases[alias] = name
}
} | go | func CreateOptionAlias(name string, alias string) EndpointOption {
return func(ep *endpoint) {
if ep.aliases == nil {
ep.aliases = make(map[string]string)
}
ep.aliases[alias] = name
}
} | [
"func",
"CreateOptionAlias",
"(",
"name",
"string",
",",
"alias",
"string",
")",
"EndpointOption",
"{",
"return",
"func",
"(",
"ep",
"*",
"endpoint",
")",
"{",
"if",
"ep",
".",
"aliases",
"==",
"nil",
"{",
"ep",
".",
"aliases",
"=",
"make",
"(",
"map",... | // CreateOptionAlias function returns an option setter for setting endpoint alias | [
"CreateOptionAlias",
"function",
"returns",
"an",
"option",
"setter",
"for",
"setting",
"endpoint",
"alias"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L1008-L1015 |
22,552 | docker/libnetwork | endpoint.go | CreateOptionService | func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig, aliases []string) EndpointOption {
return func(ep *endpoint) {
ep.svcName = name
ep.svcID = id
ep.virtualIP = vip
ep.ingressPorts = ingressPorts
ep.svcAliases = aliases
}
} | go | func CreateOptionService(name, id string, vip net.IP, ingressPorts []*PortConfig, aliases []string) EndpointOption {
return func(ep *endpoint) {
ep.svcName = name
ep.svcID = id
ep.virtualIP = vip
ep.ingressPorts = ingressPorts
ep.svcAliases = aliases
}
} | [
"func",
"CreateOptionService",
"(",
"name",
",",
"id",
"string",
",",
"vip",
"net",
".",
"IP",
",",
"ingressPorts",
"[",
"]",
"*",
"PortConfig",
",",
"aliases",
"[",
"]",
"string",
")",
"EndpointOption",
"{",
"return",
"func",
"(",
"ep",
"*",
"endpoint",... | // CreateOptionService function returns an option setter for setting service binding configuration | [
"CreateOptionService",
"function",
"returns",
"an",
"option",
"setter",
"for",
"setting",
"service",
"binding",
"configuration"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L1018-L1026 |
22,553 | docker/libnetwork | endpoint.go | CreateOptionMyAlias | func CreateOptionMyAlias(alias string) EndpointOption {
return func(ep *endpoint) {
ep.myAliases = append(ep.myAliases, alias)
}
} | go | func CreateOptionMyAlias(alias string) EndpointOption {
return func(ep *endpoint) {
ep.myAliases = append(ep.myAliases, alias)
}
} | [
"func",
"CreateOptionMyAlias",
"(",
"alias",
"string",
")",
"EndpointOption",
"{",
"return",
"func",
"(",
"ep",
"*",
"endpoint",
")",
"{",
"ep",
".",
"myAliases",
"=",
"append",
"(",
"ep",
".",
"myAliases",
",",
"alias",
")",
"\n",
"}",
"\n",
"}"
] | // CreateOptionMyAlias function returns an option setter for setting endpoint's self alias | [
"CreateOptionMyAlias",
"function",
"returns",
"an",
"option",
"setter",
"for",
"setting",
"endpoint",
"s",
"self",
"alias"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/endpoint.go#L1029-L1033 |
22,554 | docker/libnetwork | iptables/conntrack.go | DeleteConntrackEntries | func DeleteConntrackEntries(nlh *netlink.Handle, ipv4List []net.IP, ipv6List []net.IP) (uint, uint, error) {
if !IsConntrackProgrammable(nlh) {
return 0, 0, ErrConntrackNotConfigurable
}
var totalIPv4FlowPurged uint
for _, ipAddress := range ipv4List {
flowPurged, err := purgeConntrackState(nlh, syscall.AF_INE... | go | func DeleteConntrackEntries(nlh *netlink.Handle, ipv4List []net.IP, ipv6List []net.IP) (uint, uint, error) {
if !IsConntrackProgrammable(nlh) {
return 0, 0, ErrConntrackNotConfigurable
}
var totalIPv4FlowPurged uint
for _, ipAddress := range ipv4List {
flowPurged, err := purgeConntrackState(nlh, syscall.AF_INE... | [
"func",
"DeleteConntrackEntries",
"(",
"nlh",
"*",
"netlink",
".",
"Handle",
",",
"ipv4List",
"[",
"]",
"net",
".",
"IP",
",",
"ipv6List",
"[",
"]",
"net",
".",
"IP",
")",
"(",
"uint",
",",
"uint",
",",
"error",
")",
"{",
"if",
"!",
"IsConntrackProgr... | // DeleteConntrackEntries deletes all the conntrack connections on the host for the specified IP
// Returns the number of flows deleted for IPv4, IPv6 else error | [
"DeleteConntrackEntries",
"deletes",
"all",
"the",
"conntrack",
"connections",
"on",
"the",
"host",
"for",
"the",
"specified",
"IP",
"Returns",
"the",
"number",
"of",
"flows",
"deleted",
"for",
"IPv4",
"IPv6",
"else",
"error"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/conntrack.go#L24-L51 |
22,555 | docker/libnetwork | client/service.go | CmdServicePublish | func (cli *NetworkCli) CmdServicePublish(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "publish", "SERVICE[.NETWORK]", "Publish a new service on a network", false)
flAlias := opts.NewListOpts(netutils.ValidateAlias)
cmd.Var(&flAlias, []string{"-alias"}, "Add alias to self")
cmd.Require(flag.Exact, ... | go | func (cli *NetworkCli) CmdServicePublish(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "publish", "SERVICE[.NETWORK]", "Publish a new service on a network", false)
flAlias := opts.NewListOpts(netutils.ValidateAlias)
cmd.Var(&flAlias, []string{"-alias"}, "Add alias to self")
cmd.Require(flag.Exact, ... | [
"func",
"(",
"cli",
"*",
"NetworkCli",
")",
"CmdServicePublish",
"(",
"chain",
"string",
",",
"args",
"...",
"string",
")",
"error",
"{",
"cmd",
":=",
"cli",
".",
"Subcmd",
"(",
"chain",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fals... | // CmdServicePublish handles service create UI | [
"CmdServicePublish",
"handles",
"service",
"create",
"UI"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L165-L190 |
22,556 | docker/libnetwork | client/service.go | CmdServiceUnpublish | func (cli *NetworkCli) CmdServiceUnpublish(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "unpublish", "SERVICE[.NETWORK]", "Removes a service", false)
force := cmd.Bool([]string{"f", "-force"}, false, "force unpublish service")
cmd.Require(flag.Exact, 1)
err := cmd.ParseFlags(args, true)
if err !=... | go | func (cli *NetworkCli) CmdServiceUnpublish(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "unpublish", "SERVICE[.NETWORK]", "Removes a service", false)
force := cmd.Bool([]string{"f", "-force"}, false, "force unpublish service")
cmd.Require(flag.Exact, 1)
err := cmd.ParseFlags(args, true)
if err !=... | [
"func",
"(",
"cli",
"*",
"NetworkCli",
")",
"CmdServiceUnpublish",
"(",
"chain",
"string",
",",
"args",
"...",
"string",
")",
"error",
"{",
"cmd",
":=",
"cli",
".",
"Subcmd",
"(",
"chain",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fa... | // CmdServiceUnpublish handles service delete UI | [
"CmdServiceUnpublish",
"handles",
"service",
"delete",
"UI"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L193-L212 |
22,557 | docker/libnetwork | client/service.go | CmdServiceLs | func (cli *NetworkCli) CmdServiceLs(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "ls", "SERVICE", "Lists all the services on a network", false)
flNetwork := cmd.String([]string{"net", "-network"}, "", "Only show the services that are published on the specified network")
quiet := cmd.Bool([]string{"... | go | func (cli *NetworkCli) CmdServiceLs(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "ls", "SERVICE", "Lists all the services on a network", false)
flNetwork := cmd.String([]string{"net", "-network"}, "", "Only show the services that are published on the specified network")
quiet := cmd.Bool([]string{"... | [
"func",
"(",
"cli",
"*",
"NetworkCli",
")",
"CmdServiceLs",
"(",
"chain",
"string",
",",
"args",
"...",
"string",
")",
"error",
"{",
"cmd",
":=",
"cli",
".",
"Subcmd",
"(",
"chain",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
... | // CmdServiceLs handles service list UI | [
"CmdServiceLs",
"handles",
"service",
"list",
"UI"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L215-L269 |
22,558 | docker/libnetwork | client/service.go | CmdServiceInfo | func (cli *NetworkCli) CmdServiceInfo(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "info", "SERVICE[.NETWORK]", "Displays detailed information about a service", false)
cmd.Require(flag.Min, 1)
err := cmd.ParseFlags(args, true)
if err != nil {
return err
}
sn, nn := parseServiceName(cmd.Arg(0... | go | func (cli *NetworkCli) CmdServiceInfo(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "info", "SERVICE[.NETWORK]", "Displays detailed information about a service", false)
cmd.Require(flag.Min, 1)
err := cmd.ParseFlags(args, true)
if err != nil {
return err
}
sn, nn := parseServiceName(cmd.Arg(0... | [
"func",
"(",
"cli",
"*",
"NetworkCli",
")",
"CmdServiceInfo",
"(",
"chain",
"string",
",",
"args",
"...",
"string",
")",
"error",
"{",
"cmd",
":=",
"cli",
".",
"Subcmd",
"(",
"chain",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",... | // CmdServiceInfo handles service info UI | [
"CmdServiceInfo",
"handles",
"service",
"info",
"UI"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L294-L324 |
22,559 | docker/libnetwork | client/service.go | CmdServiceAttach | func (cli *NetworkCli) CmdServiceAttach(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "attach", "CONTAINER SERVICE[.NETWORK]", "Sets a container as a service backend", false)
flAlias := opts.NewListOpts(netutils.ValidateAlias)
cmd.Var(&flAlias, []string{"-alias"}, "Add alias for another container")
... | go | func (cli *NetworkCli) CmdServiceAttach(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "attach", "CONTAINER SERVICE[.NETWORK]", "Sets a container as a service backend", false)
flAlias := opts.NewListOpts(netutils.ValidateAlias)
cmd.Var(&flAlias, []string{"-alias"}, "Add alias for another container")
... | [
"func",
"(",
"cli",
"*",
"NetworkCli",
")",
"CmdServiceAttach",
"(",
"chain",
"string",
",",
"args",
"...",
"string",
")",
"error",
"{",
"cmd",
":=",
"cli",
".",
"Subcmd",
"(",
"chain",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false... | // CmdServiceAttach handles service attach UI | [
"CmdServiceAttach",
"handles",
"service",
"attach",
"UI"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L327-L358 |
22,560 | docker/libnetwork | client/service.go | CmdServiceDetach | func (cli *NetworkCli) CmdServiceDetach(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "detach", "CONTAINER SERVICE", "Removes a container from service backend", false)
cmd.Require(flag.Min, 2)
err := cmd.ParseFlags(args, true)
if err != nil {
return err
}
sn, nn := parseServiceName(cmd.Arg(1))... | go | func (cli *NetworkCli) CmdServiceDetach(chain string, args ...string) error {
cmd := cli.Subcmd(chain, "detach", "CONTAINER SERVICE", "Removes a container from service backend", false)
cmd.Require(flag.Min, 2)
err := cmd.ParseFlags(args, true)
if err != nil {
return err
}
sn, nn := parseServiceName(cmd.Arg(1))... | [
"func",
"(",
"cli",
"*",
"NetworkCli",
")",
"CmdServiceDetach",
"(",
"chain",
"string",
",",
"args",
"...",
"string",
")",
"error",
"{",
"cmd",
":=",
"cli",
".",
"Subcmd",
"(",
"chain",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false... | // CmdServiceDetach handles service detach UI | [
"CmdServiceDetach",
"handles",
"service",
"detach",
"UI"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/service.go#L361-L390 |
22,561 | docker/libnetwork | ipam/store.go | SetValue | func (aSpace *addrSpace) SetValue(value []byte) error {
rc := &addrSpace{subnets: make(map[SubnetKey]*PoolData)}
if err := json.Unmarshal(value, rc); err != nil {
return err
}
aSpace.subnets = rc.subnets
return nil
} | go | func (aSpace *addrSpace) SetValue(value []byte) error {
rc := &addrSpace{subnets: make(map[SubnetKey]*PoolData)}
if err := json.Unmarshal(value, rc); err != nil {
return err
}
aSpace.subnets = rc.subnets
return nil
} | [
"func",
"(",
"aSpace",
"*",
"addrSpace",
")",
"SetValue",
"(",
"value",
"[",
"]",
"byte",
")",
"error",
"{",
"rc",
":=",
"&",
"addrSpace",
"{",
"subnets",
":",
"make",
"(",
"map",
"[",
"SubnetKey",
"]",
"*",
"PoolData",
")",
"}",
"\n",
"if",
"err",... | // SetValue unmarshalls the data from the KV store. | [
"SetValue",
"unmarshalls",
"the",
"data",
"from",
"the",
"KV",
"store",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/store.go#L36-L43 |
22,562 | docker/libnetwork | ipvs/ipvs.go | New | func New(path string) (*Handle, error) {
setup()
n := netns.None()
if path != "" {
var err error
n, err = netns.GetFromPath(path)
if err != nil {
return nil, err
}
}
defer n.Close()
sock, err := nl.GetNetlinkSocketAt(n, netns.None(), syscall.NETLINK_GENERIC)
if err != nil {
return nil, err
}
// ... | go | func New(path string) (*Handle, error) {
setup()
n := netns.None()
if path != "" {
var err error
n, err = netns.GetFromPath(path)
if err != nil {
return nil, err
}
}
defer n.Close()
sock, err := nl.GetNetlinkSocketAt(n, netns.None(), syscall.NETLINK_GENERIC)
if err != nil {
return nil, err
}
// ... | [
"func",
"New",
"(",
"path",
"string",
")",
"(",
"*",
"Handle",
",",
"error",
")",
"{",
"setup",
"(",
")",
"\n\n",
"n",
":=",
"netns",
".",
"None",
"(",
")",
"\n",
"if",
"path",
"!=",
"\"",
"\"",
"{",
"var",
"err",
"error",
"\n",
"n",
",",
"er... | // New provides a new ipvs handle in the namespace pointed to by the
// passed path. It will return a valid handle or an error in case an
// error occurred while creating the handle. | [
"New",
"provides",
"a",
"new",
"ipvs",
"handle",
"in",
"the",
"namespace",
"pointed",
"to",
"by",
"the",
"passed",
"path",
".",
"It",
"will",
"return",
"a",
"valid",
"handle",
"or",
"an",
"error",
"in",
"case",
"an",
"error",
"occurred",
"while",
"creati... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L88-L116 |
22,563 | docker/libnetwork | ipvs/ipvs.go | NewService | func (i *Handle) NewService(s *Service) error {
return i.doCmd(s, nil, ipvsCmdNewService)
} | go | func (i *Handle) NewService(s *Service) error {
return i.doCmd(s, nil, ipvsCmdNewService)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"NewService",
"(",
"s",
"*",
"Service",
")",
"error",
"{",
"return",
"i",
".",
"doCmd",
"(",
"s",
",",
"nil",
",",
"ipvsCmdNewService",
")",
"\n",
"}"
] | // NewService creates a new ipvs service in the passed handle. | [
"NewService",
"creates",
"a",
"new",
"ipvs",
"service",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L127-L129 |
22,564 | docker/libnetwork | ipvs/ipvs.go | IsServicePresent | func (i *Handle) IsServicePresent(s *Service) bool {
return nil == i.doCmd(s, nil, ipvsCmdGetService)
} | go | func (i *Handle) IsServicePresent(s *Service) bool {
return nil == i.doCmd(s, nil, ipvsCmdGetService)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"IsServicePresent",
"(",
"s",
"*",
"Service",
")",
"bool",
"{",
"return",
"nil",
"==",
"i",
".",
"doCmd",
"(",
"s",
",",
"nil",
",",
"ipvsCmdGetService",
")",
"\n",
"}"
] | // IsServicePresent queries for the ipvs service in the passed handle. | [
"IsServicePresent",
"queries",
"for",
"the",
"ipvs",
"service",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L132-L134 |
22,565 | docker/libnetwork | ipvs/ipvs.go | UpdateService | func (i *Handle) UpdateService(s *Service) error {
return i.doCmd(s, nil, ipvsCmdSetService)
} | go | func (i *Handle) UpdateService(s *Service) error {
return i.doCmd(s, nil, ipvsCmdSetService)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"UpdateService",
"(",
"s",
"*",
"Service",
")",
"error",
"{",
"return",
"i",
".",
"doCmd",
"(",
"s",
",",
"nil",
",",
"ipvsCmdSetService",
")",
"\n",
"}"
] | // UpdateService updates an already existing service in the passed
// handle. | [
"UpdateService",
"updates",
"an",
"already",
"existing",
"service",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L138-L140 |
22,566 | docker/libnetwork | ipvs/ipvs.go | DelService | func (i *Handle) DelService(s *Service) error {
return i.doCmd(s, nil, ipvsCmdDelService)
} | go | func (i *Handle) DelService(s *Service) error {
return i.doCmd(s, nil, ipvsCmdDelService)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"DelService",
"(",
"s",
"*",
"Service",
")",
"error",
"{",
"return",
"i",
".",
"doCmd",
"(",
"s",
",",
"nil",
",",
"ipvsCmdDelService",
")",
"\n",
"}"
] | // DelService deletes an already existing service in the passed
// handle. | [
"DelService",
"deletes",
"an",
"already",
"existing",
"service",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L144-L146 |
22,567 | docker/libnetwork | ipvs/ipvs.go | Flush | func (i *Handle) Flush() error {
_, err := i.doCmdWithoutAttr(ipvsCmdFlush)
return err
} | go | func (i *Handle) Flush() error {
_, err := i.doCmdWithoutAttr(ipvsCmdFlush)
return err
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"Flush",
"(",
")",
"error",
"{",
"_",
",",
"err",
":=",
"i",
".",
"doCmdWithoutAttr",
"(",
"ipvsCmdFlush",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Flush deletes all existing services in the passed
// handle. | [
"Flush",
"deletes",
"all",
"existing",
"services",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L150-L153 |
22,568 | docker/libnetwork | ipvs/ipvs.go | NewDestination | func (i *Handle) NewDestination(s *Service, d *Destination) error {
return i.doCmd(s, d, ipvsCmdNewDest)
} | go | func (i *Handle) NewDestination(s *Service, d *Destination) error {
return i.doCmd(s, d, ipvsCmdNewDest)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"NewDestination",
"(",
"s",
"*",
"Service",
",",
"d",
"*",
"Destination",
")",
"error",
"{",
"return",
"i",
".",
"doCmd",
"(",
"s",
",",
"d",
",",
"ipvsCmdNewDest",
")",
"\n",
"}"
] | // NewDestination creates a new real server in the passed ipvs
// service which should already be existing in the passed handle. | [
"NewDestination",
"creates",
"a",
"new",
"real",
"server",
"in",
"the",
"passed",
"ipvs",
"service",
"which",
"should",
"already",
"be",
"existing",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L157-L159 |
22,569 | docker/libnetwork | ipvs/ipvs.go | UpdateDestination | func (i *Handle) UpdateDestination(s *Service, d *Destination) error {
return i.doCmd(s, d, ipvsCmdSetDest)
} | go | func (i *Handle) UpdateDestination(s *Service, d *Destination) error {
return i.doCmd(s, d, ipvsCmdSetDest)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"UpdateDestination",
"(",
"s",
"*",
"Service",
",",
"d",
"*",
"Destination",
")",
"error",
"{",
"return",
"i",
".",
"doCmd",
"(",
"s",
",",
"d",
",",
"ipvsCmdSetDest",
")",
"\n",
"}"
] | // UpdateDestination updates an already existing real server in the
// passed ipvs service in the passed handle. | [
"UpdateDestination",
"updates",
"an",
"already",
"existing",
"real",
"server",
"in",
"the",
"passed",
"ipvs",
"service",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L163-L165 |
22,570 | docker/libnetwork | ipvs/ipvs.go | DelDestination | func (i *Handle) DelDestination(s *Service, d *Destination) error {
return i.doCmd(s, d, ipvsCmdDelDest)
} | go | func (i *Handle) DelDestination(s *Service, d *Destination) error {
return i.doCmd(s, d, ipvsCmdDelDest)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"DelDestination",
"(",
"s",
"*",
"Service",
",",
"d",
"*",
"Destination",
")",
"error",
"{",
"return",
"i",
".",
"doCmd",
"(",
"s",
",",
"d",
",",
"ipvsCmdDelDest",
")",
"\n",
"}"
] | // DelDestination deletes an already existing real server in the
// passed ipvs service in the passed handle. | [
"DelDestination",
"deletes",
"an",
"already",
"existing",
"real",
"server",
"in",
"the",
"passed",
"ipvs",
"service",
"in",
"the",
"passed",
"handle",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L169-L171 |
22,571 | docker/libnetwork | ipvs/ipvs.go | GetDestinations | func (i *Handle) GetDestinations(s *Service) ([]*Destination, error) {
return i.doGetDestinationsCmd(s, nil)
} | go | func (i *Handle) GetDestinations(s *Service) ([]*Destination, error) {
return i.doGetDestinationsCmd(s, nil)
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"GetDestinations",
"(",
"s",
"*",
"Service",
")",
"(",
"[",
"]",
"*",
"Destination",
",",
"error",
")",
"{",
"return",
"i",
".",
"doGetDestinationsCmd",
"(",
"s",
",",
"nil",
")",
"\n",
"}"
] | // GetDestinations returns an array of Destinations configured for this Service | [
"GetDestinations",
"returns",
"an",
"array",
"of",
"Destinations",
"configured",
"for",
"this",
"Service"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L179-L181 |
22,572 | docker/libnetwork | ipvs/ipvs.go | GetService | func (i *Handle) GetService(s *Service) (*Service, error) {
res, err := i.doGetServicesCmd(s)
if err != nil {
return nil, err
}
// We are looking for exactly one service otherwise error out
if len(res) != 1 {
return nil, fmt.Errorf("Expected only one service obtained=%d", len(res))
}
return res[0], nil
} | go | func (i *Handle) GetService(s *Service) (*Service, error) {
res, err := i.doGetServicesCmd(s)
if err != nil {
return nil, err
}
// We are looking for exactly one service otherwise error out
if len(res) != 1 {
return nil, fmt.Errorf("Expected only one service obtained=%d", len(res))
}
return res[0], nil
} | [
"func",
"(",
"i",
"*",
"Handle",
")",
"GetService",
"(",
"s",
"*",
"Service",
")",
"(",
"*",
"Service",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"i",
".",
"doGetServicesCmd",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // GetService gets details of a specific IPVS services, useful in updating statisics etc., | [
"GetService",
"gets",
"details",
"of",
"a",
"specific",
"IPVS",
"services",
"useful",
"in",
"updating",
"statisics",
"etc",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipvs/ipvs.go#L184-L197 |
22,573 | docker/libnetwork | portmapper/mapper.go | NewWithPortAllocator | func NewWithPortAllocator(allocator *portallocator.PortAllocator, proxyPath string) *PortMapper {
return &PortMapper{
currentMappings: make(map[string]*mapping),
Allocator: allocator,
proxyPath: proxyPath,
}
} | go | func NewWithPortAllocator(allocator *portallocator.PortAllocator, proxyPath string) *PortMapper {
return &PortMapper{
currentMappings: make(map[string]*mapping),
Allocator: allocator,
proxyPath: proxyPath,
}
} | [
"func",
"NewWithPortAllocator",
"(",
"allocator",
"*",
"portallocator",
".",
"PortAllocator",
",",
"proxyPath",
"string",
")",
"*",
"PortMapper",
"{",
"return",
"&",
"PortMapper",
"{",
"currentMappings",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"mappi... | // NewWithPortAllocator returns a new instance of PortMapper which will use the specified PortAllocator | [
"NewWithPortAllocator",
"returns",
"a",
"new",
"instance",
"of",
"PortMapper",
"which",
"will",
"use",
"the",
"specified",
"PortAllocator"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper.go#L39-L45 |
22,574 | docker/libnetwork | portmapper/mapper.go | Map | func (pm *PortMapper) Map(container net.Addr, hostIP net.IP, hostPort int, useProxy bool) (host net.Addr, err error) {
return pm.MapRange(container, hostIP, hostPort, hostPort, useProxy)
} | go | func (pm *PortMapper) Map(container net.Addr, hostIP net.IP, hostPort int, useProxy bool) (host net.Addr, err error) {
return pm.MapRange(container, hostIP, hostPort, hostPort, useProxy)
} | [
"func",
"(",
"pm",
"*",
"PortMapper",
")",
"Map",
"(",
"container",
"net",
".",
"Addr",
",",
"hostIP",
"net",
".",
"IP",
",",
"hostPort",
"int",
",",
"useProxy",
"bool",
")",
"(",
"host",
"net",
".",
"Addr",
",",
"err",
"error",
")",
"{",
"return",... | // Map maps the specified container transport address to the host's network address and transport port | [
"Map",
"maps",
"the",
"specified",
"container",
"transport",
"address",
"to",
"the",
"host",
"s",
"network",
"address",
"and",
"transport",
"port"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper.go#L48-L50 |
22,575 | docker/libnetwork | portmapper/mapper.go | Unmap | func (pm *PortMapper) Unmap(host net.Addr) error {
pm.lock.Lock()
defer pm.lock.Unlock()
key := getKey(host)
data, exists := pm.currentMappings[key]
if !exists {
return ErrPortNotMapped
}
if data.userlandProxy != nil {
data.userlandProxy.Stop()
}
delete(pm.currentMappings, key)
containerIP, containerP... | go | func (pm *PortMapper) Unmap(host net.Addr) error {
pm.lock.Lock()
defer pm.lock.Unlock()
key := getKey(host)
data, exists := pm.currentMappings[key]
if !exists {
return ErrPortNotMapped
}
if data.userlandProxy != nil {
data.userlandProxy.Stop()
}
delete(pm.currentMappings, key)
containerIP, containerP... | [
"func",
"(",
"pm",
"*",
"PortMapper",
")",
"Unmap",
"(",
"host",
"net",
".",
"Addr",
")",
"error",
"{",
"pm",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pm",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"key",
":=",
"getKey",
"(",
"ho... | // Unmap removes stored mapping for the specified host transport address | [
"Unmap",
"removes",
"stored",
"mapping",
"for",
"the",
"specified",
"host",
"transport",
"address"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper.go#L185-L219 |
22,576 | docker/libnetwork | portmapper/mapper.go | ReMapAll | func (pm *PortMapper) ReMapAll() {
pm.lock.Lock()
defer pm.lock.Unlock()
logrus.Debugln("Re-applying all port mappings.")
for _, data := range pm.currentMappings {
containerIP, containerPort := getIPAndPort(data.container)
hostIP, hostPort := getIPAndPort(data.host)
if err := pm.AppendForwardingTableEntry(dat... | go | func (pm *PortMapper) ReMapAll() {
pm.lock.Lock()
defer pm.lock.Unlock()
logrus.Debugln("Re-applying all port mappings.")
for _, data := range pm.currentMappings {
containerIP, containerPort := getIPAndPort(data.container)
hostIP, hostPort := getIPAndPort(data.host)
if err := pm.AppendForwardingTableEntry(dat... | [
"func",
"(",
"pm",
"*",
"PortMapper",
")",
"ReMapAll",
"(",
")",
"{",
"pm",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pm",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"logrus",
".",
"Debugln",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
... | //ReMapAll will re-apply all port mappings | [
"ReMapAll",
"will",
"re",
"-",
"apply",
"all",
"port",
"mappings"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/portmapper/mapper.go#L222-L233 |
22,577 | docker/libnetwork | datastore/mock_store.go | Get | func (s *MockStore) Get(key string) (*store.KVPair, error) {
mData := s.db[key]
if mData == nil {
return nil, nil
}
return &store.KVPair{Value: mData.Data, LastIndex: mData.Index}, nil
} | go | func (s *MockStore) Get(key string) (*store.KVPair, error) {
mData := s.db[key]
if mData == nil {
return nil, nil
}
return &store.KVPair{Value: mData.Data, LastIndex: mData.Index}, nil
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"Get",
"(",
"key",
"string",
")",
"(",
"*",
"store",
".",
"KVPair",
",",
"error",
")",
"{",
"mData",
":=",
"s",
".",
"db",
"[",
"key",
"]",
"\n",
"if",
"mData",
"==",
"nil",
"{",
"return",
"nil",
",",
... | // Get the value at "key", returns the last modified index
// to use in conjunction to CAS calls | [
"Get",
"the",
"value",
"at",
"key",
"returns",
"the",
"last",
"modified",
"index",
"to",
"use",
"in",
"conjunction",
"to",
"CAS",
"calls"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L34-L41 |
22,578 | docker/libnetwork | datastore/mock_store.go | Put | func (s *MockStore) Put(key string, value []byte, options *store.WriteOptions) error {
mData := s.db[key]
if mData == nil {
mData = &MockData{value, 0}
}
mData.Index = mData.Index + 1
s.db[key] = mData
return nil
} | go | func (s *MockStore) Put(key string, value []byte, options *store.WriteOptions) error {
mData := s.db[key]
if mData == nil {
mData = &MockData{value, 0}
}
mData.Index = mData.Index + 1
s.db[key] = mData
return nil
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"Put",
"(",
"key",
"string",
",",
"value",
"[",
"]",
"byte",
",",
"options",
"*",
"store",
".",
"WriteOptions",
")",
"error",
"{",
"mData",
":=",
"s",
".",
"db",
"[",
"key",
"]",
"\n",
"if",
"mData",
"==",... | // Put a value at "key" | [
"Put",
"a",
"value",
"at",
"key"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L44-L52 |
22,579 | docker/libnetwork | datastore/mock_store.go | Delete | func (s *MockStore) Delete(key string) error {
delete(s.db, key)
return nil
} | go | func (s *MockStore) Delete(key string) error {
delete(s.db, key)
return nil
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"Delete",
"(",
"key",
"string",
")",
"error",
"{",
"delete",
"(",
"s",
".",
"db",
",",
"key",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Delete a value at "key" | [
"Delete",
"a",
"value",
"at",
"key"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L55-L58 |
22,580 | docker/libnetwork | datastore/mock_store.go | Exists | func (s *MockStore) Exists(key string) (bool, error) {
_, ok := s.db[key]
return ok, nil
} | go | func (s *MockStore) Exists(key string) (bool, error) {
_, ok := s.db[key]
return ok, nil
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"Exists",
"(",
"key",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"_",
",",
"ok",
":=",
"s",
".",
"db",
"[",
"key",
"]",
"\n",
"return",
"ok",
",",
"nil",
"\n",
"}"
] | // Exists checks that the key exists inside the store | [
"Exists",
"checks",
"that",
"the",
"key",
"exists",
"inside",
"the",
"store"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L61-L64 |
22,581 | docker/libnetwork | datastore/mock_store.go | List | func (s *MockStore) List(prefix string) ([]*store.KVPair, error) {
return nil, ErrNotImplemented
} | go | func (s *MockStore) List(prefix string) ([]*store.KVPair, error) {
return nil, ErrNotImplemented
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"List",
"(",
"prefix",
"string",
")",
"(",
"[",
"]",
"*",
"store",
".",
"KVPair",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotImplemented",
"\n",
"}"
] | // List gets a range of values at "directory" | [
"List",
"gets",
"a",
"range",
"of",
"values",
"at",
"directory"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L67-L69 |
22,582 | docker/libnetwork | datastore/mock_store.go | DeleteTree | func (s *MockStore) DeleteTree(prefix string) error {
delete(s.db, prefix)
return nil
} | go | func (s *MockStore) DeleteTree(prefix string) error {
delete(s.db, prefix)
return nil
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"DeleteTree",
"(",
"prefix",
"string",
")",
"error",
"{",
"delete",
"(",
"s",
".",
"db",
",",
"prefix",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // DeleteTree deletes a range of values at "directory" | [
"DeleteTree",
"deletes",
"a",
"range",
"of",
"values",
"at",
"directory"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L72-L75 |
22,583 | docker/libnetwork | datastore/mock_store.go | Watch | func (s *MockStore) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error) {
return nil, ErrNotImplemented
} | go | func (s *MockStore) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error) {
return nil, ErrNotImplemented
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"Watch",
"(",
"key",
"string",
",",
"stopCh",
"<-",
"chan",
"struct",
"{",
"}",
")",
"(",
"<-",
"chan",
"*",
"store",
".",
"KVPair",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotImplemented",
"\n",
"... | // Watch a single key for modifications | [
"Watch",
"a",
"single",
"key",
"for",
"modifications"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L78-L80 |
22,584 | docker/libnetwork | datastore/mock_store.go | WatchTree | func (s *MockStore) WatchTree(prefix string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error) {
return nil, ErrNotImplemented
} | go | func (s *MockStore) WatchTree(prefix string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error) {
return nil, ErrNotImplemented
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"WatchTree",
"(",
"prefix",
"string",
",",
"stopCh",
"<-",
"chan",
"struct",
"{",
"}",
")",
"(",
"<-",
"chan",
"[",
"]",
"*",
"store",
".",
"KVPair",
",",
"error",
")",
"{",
"return",
"nil",
",",
"ErrNotImpl... | // WatchTree triggers a watch on a range of values at "directory" | [
"WatchTree",
"triggers",
"a",
"watch",
"on",
"a",
"range",
"of",
"values",
"at",
"directory"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L83-L85 |
22,585 | docker/libnetwork | datastore/mock_store.go | AtomicPut | func (s *MockStore) AtomicPut(key string, newValue []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error) {
mData := s.db[key]
if previous == nil {
if mData != nil {
return false, nil, types.BadRequestErrorf("atomic put failed because key exists")
} // Else OK.
} else {
i... | go | func (s *MockStore) AtomicPut(key string, newValue []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error) {
mData := s.db[key]
if previous == nil {
if mData != nil {
return false, nil, types.BadRequestErrorf("atomic put failed because key exists")
} // Else OK.
} else {
i... | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"AtomicPut",
"(",
"key",
"string",
",",
"newValue",
"[",
"]",
"byte",
",",
"previous",
"*",
"store",
".",
"KVPair",
",",
"options",
"*",
"store",
".",
"WriteOptions",
")",
"(",
"bool",
",",
"*",
"store",
".",
... | // AtomicPut put a value at "key" if the key has not been
// modified in the meantime, throws an error if this is the case | [
"AtomicPut",
"put",
"a",
"value",
"at",
"key",
"if",
"the",
"key",
"has",
"not",
"been",
"modified",
"in",
"the",
"meantime",
"throws",
"an",
"error",
"if",
"this",
"is",
"the",
"case"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L94-L114 |
22,586 | docker/libnetwork | datastore/mock_store.go | AtomicDelete | func (s *MockStore) AtomicDelete(key string, previous *store.KVPair) (bool, error) {
mData := s.db[key]
if mData != nil && mData.Index != previous.LastIndex {
return false, types.BadRequestErrorf("atomic delete failed due to mismatched Index")
}
return true, s.Delete(key)
} | go | func (s *MockStore) AtomicDelete(key string, previous *store.KVPair) (bool, error) {
mData := s.db[key]
if mData != nil && mData.Index != previous.LastIndex {
return false, types.BadRequestErrorf("atomic delete failed due to mismatched Index")
}
return true, s.Delete(key)
} | [
"func",
"(",
"s",
"*",
"MockStore",
")",
"AtomicDelete",
"(",
"key",
"string",
",",
"previous",
"*",
"store",
".",
"KVPair",
")",
"(",
"bool",
",",
"error",
")",
"{",
"mData",
":=",
"s",
".",
"db",
"[",
"key",
"]",
"\n",
"if",
"mData",
"!=",
"nil... | // AtomicDelete deletes a value at "key" if the key has not
// been modified in the meantime, throws an error if this is the case | [
"AtomicDelete",
"deletes",
"a",
"value",
"at",
"key",
"if",
"the",
"key",
"has",
"not",
"been",
"modified",
"in",
"the",
"meantime",
"throws",
"an",
"error",
"if",
"this",
"is",
"the",
"case"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/mock_store.go#L118-L124 |
22,587 | docker/libnetwork | resolver.go | NewResolver | func NewResolver(address string, proxyDNS bool, resolverKey string, backend DNSBackend) Resolver {
return &resolver{
backend: backend,
proxyDNS: proxyDNS,
listenAddress: address,
resolverKey: resolverKey,
err: fmt.Errorf("setup not done yet"),
startCh: make(chan struct{}, 1),
... | go | func NewResolver(address string, proxyDNS bool, resolverKey string, backend DNSBackend) Resolver {
return &resolver{
backend: backend,
proxyDNS: proxyDNS,
listenAddress: address,
resolverKey: resolverKey,
err: fmt.Errorf("setup not done yet"),
startCh: make(chan struct{}, 1),
... | [
"func",
"NewResolver",
"(",
"address",
"string",
",",
"proxyDNS",
"bool",
",",
"resolverKey",
"string",
",",
"backend",
"DNSBackend",
")",
"Resolver",
"{",
"return",
"&",
"resolver",
"{",
"backend",
":",
"backend",
",",
"proxyDNS",
":",
"proxyDNS",
",",
"lis... | // NewResolver creates a new instance of the Resolver | [
"NewResolver",
"creates",
"a",
"new",
"instance",
"of",
"the",
"Resolver"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/resolver.go#L102-L111 |
22,588 | docker/libnetwork | ipam/utils.go | generateAddress | func generateAddress(ordinal uint64, network *net.IPNet) net.IP {
var address [16]byte
// Get network portion of IP
if getAddressVersion(network.IP) == v4 {
copy(address[:], network.IP.To4())
} else {
copy(address[:], network.IP)
}
end := len(network.Mask)
addIntToIP(address[:end], ordinal)
return net.IP... | go | func generateAddress(ordinal uint64, network *net.IPNet) net.IP {
var address [16]byte
// Get network portion of IP
if getAddressVersion(network.IP) == v4 {
copy(address[:], network.IP.To4())
} else {
copy(address[:], network.IP)
}
end := len(network.Mask)
addIntToIP(address[:end], ordinal)
return net.IP... | [
"func",
"generateAddress",
"(",
"ordinal",
"uint64",
",",
"network",
"*",
"net",
".",
"IPNet",
")",
"net",
".",
"IP",
"{",
"var",
"address",
"[",
"16",
"]",
"byte",
"\n\n",
"// Get network portion of IP",
"if",
"getAddressVersion",
"(",
"network",
".",
"IP",... | // It generates the ip address in the passed subnet specified by
// the passed host address ordinal | [
"It",
"generates",
"the",
"ip",
"address",
"in",
"the",
"passed",
"subnet",
"specified",
"by",
"the",
"passed",
"host",
"address",
"ordinal"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/utils.go#L41-L55 |
22,589 | docker/libnetwork | ipam/utils.go | addIntToIP | func addIntToIP(array []byte, ordinal uint64) {
for i := len(array) - 1; i >= 0; i-- {
array[i] |= (byte)(ordinal & 0xff)
ordinal >>= 8
}
} | go | func addIntToIP(array []byte, ordinal uint64) {
for i := len(array) - 1; i >= 0; i-- {
array[i] |= (byte)(ordinal & 0xff)
ordinal >>= 8
}
} | [
"func",
"addIntToIP",
"(",
"array",
"[",
"]",
"byte",
",",
"ordinal",
"uint64",
")",
"{",
"for",
"i",
":=",
"len",
"(",
"array",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"array",
"[",
"i",
"]",
"|=",
"(",
"byte",
")",
"(",
"... | // Adds the ordinal IP to the current array
// 192.168.0.0 + 53 => 192.168.0.53 | [
"Adds",
"the",
"ordinal",
"IP",
"to",
"the",
"current",
"array",
"192",
".",
"168",
".",
"0",
".",
"0",
"+",
"53",
"=",
">",
"192",
".",
"168",
".",
"0",
".",
"53"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/utils.go#L66-L71 |
22,590 | docker/libnetwork | ipam/utils.go | ipToUint64 | func ipToUint64(ip []byte) (value uint64) {
cip := types.GetMinimalIP(ip)
for i := 0; i < len(cip); i++ {
j := len(cip) - 1 - i
value += uint64(cip[i]) << uint(j*8)
}
return value
} | go | func ipToUint64(ip []byte) (value uint64) {
cip := types.GetMinimalIP(ip)
for i := 0; i < len(cip); i++ {
j := len(cip) - 1 - i
value += uint64(cip[i]) << uint(j*8)
}
return value
} | [
"func",
"ipToUint64",
"(",
"ip",
"[",
"]",
"byte",
")",
"(",
"value",
"uint64",
")",
"{",
"cip",
":=",
"types",
".",
"GetMinimalIP",
"(",
"ip",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"cip",
")",
";",
"i",
"++",
"{",
"j",... | // Convert an ordinal to the respective IP address | [
"Convert",
"an",
"ordinal",
"to",
"the",
"respective",
"IP",
"address"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/utils.go#L74-L81 |
22,591 | docker/libnetwork | netlabel/labels.go | Key | func Key(label string) (key string) {
if kv := strings.SplitN(label, "=", 2); len(kv) > 0 {
key = kv[0]
}
return
} | go | func Key(label string) (key string) {
if kv := strings.SplitN(label, "=", 2); len(kv) > 0 {
key = kv[0]
}
return
} | [
"func",
"Key",
"(",
"label",
"string",
")",
"(",
"key",
"string",
")",
"{",
"if",
"kv",
":=",
"strings",
".",
"SplitN",
"(",
"label",
",",
"\"",
"\"",
",",
"2",
")",
";",
"len",
"(",
"kv",
")",
">",
"0",
"{",
"key",
"=",
"kv",
"[",
"0",
"]"... | // Key extracts the key portion of the label | [
"Key",
"extracts",
"the",
"key",
"portion",
"of",
"the",
"label"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netlabel/labels.go#L105-L110 |
22,592 | docker/libnetwork | netlabel/labels.go | Value | func Value(label string) (value string) {
if kv := strings.SplitN(label, "=", 2); len(kv) > 1 {
value = kv[1]
}
return
} | go | func Value(label string) (value string) {
if kv := strings.SplitN(label, "=", 2); len(kv) > 1 {
value = kv[1]
}
return
} | [
"func",
"Value",
"(",
"label",
"string",
")",
"(",
"value",
"string",
")",
"{",
"if",
"kv",
":=",
"strings",
".",
"SplitN",
"(",
"label",
",",
"\"",
"\"",
",",
"2",
")",
";",
"len",
"(",
"kv",
")",
">",
"1",
"{",
"value",
"=",
"kv",
"[",
"1",... | // Value extracts the value portion of the label | [
"Value",
"extracts",
"the",
"value",
"portion",
"of",
"the",
"label"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netlabel/labels.go#L113-L118 |
22,593 | docker/libnetwork | ipams/windowsipam/windowsipam.go | GetInit | func GetInit(ipamName string) func(ic ipamapi.Callback, l, g interface{}) error {
return func(ic ipamapi.Callback, l, g interface{}) error {
return ic.RegisterIpamDriver(ipamName, &allocator{})
}
} | go | func GetInit(ipamName string) func(ic ipamapi.Callback, l, g interface{}) error {
return func(ic ipamapi.Callback, l, g interface{}) error {
return ic.RegisterIpamDriver(ipamName, &allocator{})
}
} | [
"func",
"GetInit",
"(",
"ipamName",
"string",
")",
"func",
"(",
"ic",
"ipamapi",
".",
"Callback",
",",
"l",
",",
"g",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"func",
"(",
"ic",
"ipamapi",
".",
"Callback",
",",
"l",
",",
"g",
"interface",
... | // GetInit registers the built-in ipam service with libnetwork | [
"GetInit",
"registers",
"the",
"built",
"-",
"in",
"ipam",
"service",
"with",
"libnetwork"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/windowsipam/windowsipam.go#L28-L32 |
22,594 | docker/libnetwork | ipams/windowsipam/windowsipam.go | RequestPool | func (a *allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {
logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
if subPool != "" || v6 {
return "", nil, nil, types.InternalErrorf("This... | go | func (a *allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {
logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
if subPool != "" || v6 {
return "", nil, nil, types.InternalErrorf("This... | [
"func",
"(",
"a",
"*",
"allocator",
")",
"RequestPool",
"(",
"addressSpace",
",",
"pool",
",",
"subPool",
"string",
",",
"options",
"map",
"[",
"string",
"]",
"string",
",",
"v6",
"bool",
")",
"(",
"string",
",",
"*",
"net",
".",
"IPNet",
",",
"map",... | // RequestPool returns an address pool along with its unique id. This is a null ipam driver. It allocates the
// subnet user asked and does not validate anything. Doesn't support subpool allocation | [
"RequestPool",
"returns",
"an",
"address",
"pool",
"along",
"with",
"its",
"unique",
"id",
".",
"This",
"is",
"a",
"null",
"ipam",
"driver",
".",
"It",
"allocates",
"the",
"subnet",
"user",
"asked",
"and",
"does",
"not",
"validate",
"anything",
".",
"Doesn... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/windowsipam/windowsipam.go#L40-L59 |
22,595 | docker/libnetwork | ipams/windowsipam/windowsipam.go | ReleasePool | func (a *allocator) ReleasePool(poolID string) error {
logrus.Debugf("ReleasePool(%s)", poolID)
return nil
} | go | func (a *allocator) ReleasePool(poolID string) error {
logrus.Debugf("ReleasePool(%s)", poolID)
return nil
} | [
"func",
"(",
"a",
"*",
"allocator",
")",
"ReleasePool",
"(",
"poolID",
"string",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"poolID",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // ReleasePool releases the address pool - always succeeds | [
"ReleasePool",
"releases",
"the",
"address",
"pool",
"-",
"always",
"succeeds"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/windowsipam/windowsipam.go#L62-L65 |
22,596 | docker/libnetwork | ipams/windowsipam/windowsipam.go | ReleaseAddress | func (a *allocator) ReleaseAddress(poolID string, address net.IP) error {
logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address)
return nil
} | go | func (a *allocator) ReleaseAddress(poolID string, address net.IP) error {
logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address)
return nil
} | [
"func",
"(",
"a",
"*",
"allocator",
")",
"ReleaseAddress",
"(",
"poolID",
"string",
",",
"address",
"net",
".",
"IP",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"poolID",
",",
"address",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // ReleaseAddress releases the address - always succeeds | [
"ReleaseAddress",
"releases",
"the",
"address",
"-",
"always",
"succeeds"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/windowsipam/windowsipam.go#L85-L88 |
22,597 | docker/libnetwork | ipams/remote/api/api.go | ToCapability | func (capRes GetCapabilityResponse) ToCapability() *ipamapi.Capability {
return &ipamapi.Capability{
RequiresMACAddress: capRes.RequiresMACAddress,
RequiresRequestReplay: capRes.RequiresRequestReplay,
}
} | go | func (capRes GetCapabilityResponse) ToCapability() *ipamapi.Capability {
return &ipamapi.Capability{
RequiresMACAddress: capRes.RequiresMACAddress,
RequiresRequestReplay: capRes.RequiresRequestReplay,
}
} | [
"func",
"(",
"capRes",
"GetCapabilityResponse",
")",
"ToCapability",
"(",
")",
"*",
"ipamapi",
".",
"Capability",
"{",
"return",
"&",
"ipamapi",
".",
"Capability",
"{",
"RequiresMACAddress",
":",
"capRes",
".",
"RequiresMACAddress",
",",
"RequiresRequestReplay",
"... | // ToCapability converts the capability response into the internal ipam driver capability structure | [
"ToCapability",
"converts",
"the",
"capability",
"response",
"into",
"the",
"internal",
"ipam",
"driver",
"capability",
"structure"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/remote/api/api.go#L30-L35 |
22,598 | docker/libnetwork | driverapi/driverapi.go | IsValidType | func IsValidType(objType ObjectType) bool {
switch objType {
case EndpointObject:
fallthrough
case NetworkObject:
fallthrough
case OpaqueObject:
return true
}
return false
} | go | func IsValidType(objType ObjectType) bool {
switch objType {
case EndpointObject:
fallthrough
case NetworkObject:
fallthrough
case OpaqueObject:
return true
}
return false
} | [
"func",
"IsValidType",
"(",
"objType",
"ObjectType",
")",
"bool",
"{",
"switch",
"objType",
"{",
"case",
"EndpointObject",
":",
"fallthrough",
"\n",
"case",
"NetworkObject",
":",
"fallthrough",
"\n",
"case",
"OpaqueObject",
":",
"return",
"true",
"\n",
"}",
"\... | // IsValidType validates the passed in type against the valid object types | [
"IsValidType",
"validates",
"the",
"passed",
"in",
"type",
"against",
"the",
"valid",
"object",
"types"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/driverapi/driverapi.go#L203-L213 |
22,599 | docker/libnetwork | network.go | Validate | func (c *IpamConf) Validate() error {
if c.Gateway != "" && nil == net.ParseIP(c.Gateway) {
return types.BadRequestErrorf("invalid gateway address %s in Ipam configuration", c.Gateway)
}
return nil
} | go | func (c *IpamConf) Validate() error {
if c.Gateway != "" && nil == net.ParseIP(c.Gateway) {
return types.BadRequestErrorf("invalid gateway address %s in Ipam configuration", c.Gateway)
}
return nil
} | [
"func",
"(",
"c",
"*",
"IpamConf",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"c",
".",
"Gateway",
"!=",
"\"",
"\"",
"&&",
"nil",
"==",
"net",
".",
"ParseIP",
"(",
"c",
".",
"Gateway",
")",
"{",
"return",
"types",
".",
"BadRequestErrorf",
"(",
... | // Validate checks whether the configuration is valid | [
"Validate",
"checks",
"whether",
"the",
"configuration",
"is",
"valid"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/network.go#L146-L151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.