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,300 | onsi/ginkgo | ginkgo_dsl.go | It | func It(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...))
return true
} | go | func It(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...))
return true
} | [
"func",
"It",
"(",
"text",
"string",
",",
"body",
"interface",
"{",
"}",
",",
"timeout",
"...",
"float64",
")",
"bool",
"{",
"globalSuite",
".",
"PushItNode",
"(",
"text",
",",
"body",
",",
"types",
".",
"FlagTypeNone",
",",
"codelocation",
".",
"New",
... | //It blocks contain your test code and assertions. You cannot nest any other Ginkgo blocks
//within an It block.
//
//Ginkgo will normally run It blocks synchronously. To perform asynchronous tests, pass a
//function that accepts a Done channel. When you do this, you can also provide an optional timeout. | [
"It",
"blocks",
"contain",
"your",
"test",
"code",
"and",
"assertions",
".",
"You",
"cannot",
"nest",
"any",
"other",
"Ginkgo",
"blocks",
"within",
"an",
"It",
"block",
".",
"Ginkgo",
"will",
"normally",
"run",
"It",
"blocks",
"synchronously",
".",
"To",
"... | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L374-L377 |
22,301 | onsi/ginkgo | ginkgo_dsl.go | FIt | func FIt(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...))
return true
} | go | func FIt(text string, body interface{}, timeout ...float64) bool {
globalSuite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...))
return true
} | [
"func",
"FIt",
"(",
"text",
"string",
",",
"body",
"interface",
"{",
"}",
",",
"timeout",
"...",
"float64",
")",
"bool",
"{",
"globalSuite",
".",
"PushItNode",
"(",
"text",
",",
"body",
",",
"types",
".",
"FlagTypeFocused",
",",
"codelocation",
".",
"New... | //You can focus individual Its using FIt | [
"You",
"can",
"focus",
"individual",
"Its",
"using",
"FIt"
] | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L380-L383 |
22,302 | onsi/ginkgo | ginkgo_dsl.go | PIt | func PIt(text string, _ ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true
} | go | func PIt(text string, _ ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true
} | [
"func",
"PIt",
"(",
"text",
"string",
",",
"_",
"...",
"interface",
"{",
"}",
")",
"bool",
"{",
"globalSuite",
".",
"PushItNode",
"(",
"text",
",",
"func",
"(",
")",
"{",
"}",
",",
"types",
".",
"FlagTypePending",
",",
"codelocation",
".",
"New",
"("... | //You can mark Its as pending using PIt | [
"You",
"can",
"mark",
"Its",
"as",
"pending",
"using",
"PIt"
] | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L386-L389 |
22,303 | onsi/ginkgo | ginkgo_dsl.go | PSpecify | func PSpecify(text string, is ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true
} | go | func PSpecify(text string, is ...interface{}) bool {
globalSuite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0)
return true
} | [
"func",
"PSpecify",
"(",
"text",
"string",
",",
"is",
"...",
"interface",
"{",
"}",
")",
"bool",
"{",
"globalSuite",
".",
"PushItNode",
"(",
"text",
",",
"func",
"(",
")",
"{",
"}",
",",
"types",
".",
"FlagTypePending",
",",
"codelocation",
".",
"New",... | //You can mark Specifys as pending using PSpecify | [
"You",
"can",
"mark",
"Specifys",
"as",
"pending",
"using",
"PSpecify"
] | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L412-L415 |
22,304 | onsi/ginkgo | ginkgo_dsl.go | FMeasure | func FMeasure(text string, body interface{}, samples int) bool {
globalSuite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples)
return true
} | go | func FMeasure(text string, body interface{}, samples int) bool {
globalSuite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples)
return true
} | [
"func",
"FMeasure",
"(",
"text",
"string",
",",
"body",
"interface",
"{",
"}",
",",
"samples",
"int",
")",
"bool",
"{",
"globalSuite",
".",
"PushMeasureNode",
"(",
"text",
",",
"body",
",",
"types",
".",
"FlagTypeFocused",
",",
"codelocation",
".",
"New",
... | //You can focus individual Measures using FMeasure | [
"You",
"can",
"focus",
"individual",
"Measures",
"using",
"FMeasure"
] | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L455-L458 |
22,305 | onsi/ginkgo | ginkgo_dsl.go | PMeasure | func PMeasure(text string, _ ...interface{}) bool {
globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0)
return true
} | go | func PMeasure(text string, _ ...interface{}) bool {
globalSuite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0)
return true
} | [
"func",
"PMeasure",
"(",
"text",
"string",
",",
"_",
"...",
"interface",
"{",
"}",
")",
"bool",
"{",
"globalSuite",
".",
"PushMeasureNode",
"(",
"text",
",",
"func",
"(",
"b",
"Benchmarker",
")",
"{",
"}",
",",
"types",
".",
"FlagTypePending",
",",
"co... | //You can mark Measurements as pending using PMeasure | [
"You",
"can",
"mark",
"Measurements",
"as",
"pending",
"using",
"PMeasure"
] | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L461-L464 |
22,306 | onsi/ginkgo | ginkgo_dsl.go | BeforeEach | func BeforeEach(body interface{}, timeout ...float64) bool {
globalSuite.PushBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true
} | go | func BeforeEach(body interface{}, timeout ...float64) bool {
globalSuite.PushBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true
} | [
"func",
"BeforeEach",
"(",
"body",
"interface",
"{",
"}",
",",
"timeout",
"...",
"float64",
")",
"bool",
"{",
"globalSuite",
".",
"PushBeforeEachNode",
"(",
"body",
",",
"codelocation",
".",
"New",
"(",
"1",
")",
",",
"parseTimeout",
"(",
"timeout",
"...",... | //BeforeEach blocks are run before It blocks. When multiple BeforeEach blocks are defined in nested
//Describe and Context blocks the outermost BeforeEach blocks are run first.
//
//Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts
//a Done channel | [
"BeforeEach",
"blocks",
"are",
"run",
"before",
"It",
"blocks",
".",
"When",
"multiple",
"BeforeEach",
"blocks",
"are",
"defined",
"in",
"nested",
"Describe",
"and",
"Context",
"blocks",
"the",
"outermost",
"BeforeEach",
"blocks",
"are",
"run",
"first",
".",
"... | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L578-L581 |
22,307 | onsi/ginkgo | ginkgo_dsl.go | AfterEach | func AfterEach(body interface{}, timeout ...float64) bool {
globalSuite.PushAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true
} | go | func AfterEach(body interface{}, timeout ...float64) bool {
globalSuite.PushAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...))
return true
} | [
"func",
"AfterEach",
"(",
"body",
"interface",
"{",
"}",
",",
"timeout",
"...",
"float64",
")",
"bool",
"{",
"globalSuite",
".",
"PushAfterEachNode",
"(",
"body",
",",
"codelocation",
".",
"New",
"(",
"1",
")",
",",
"parseTimeout",
"(",
"timeout",
"...",
... | //AfterEach blocks are run after It blocks. When multiple AfterEach blocks are defined in nested
//Describe and Context blocks the innermost AfterEach blocks are run first.
//
//Like It blocks, AfterEach blocks can be made asynchronous by providing a body function that accepts
//a Done channel | [
"AfterEach",
"blocks",
"are",
"run",
"after",
"It",
"blocks",
".",
"When",
"multiple",
"AfterEach",
"blocks",
"are",
"defined",
"in",
"nested",
"Describe",
"and",
"Context",
"blocks",
"the",
"innermost",
"AfterEach",
"blocks",
"are",
"run",
"first",
".",
"Like... | eea6ad008b96acdaa524f5b409513bf062b500ad | https://github.com/onsi/ginkgo/blob/eea6ad008b96acdaa524f5b409513bf062b500ad/ginkgo_dsl.go#L608-L611 |
22,308 | docker/libnetwork | drivers/macvlan/macvlan_store.go | initStore | func (d *driver) initStore(option map[string]interface{}) error {
if data, ok := option[netlabel.LocalKVClient]; ok {
var err error
dsc, ok := data.(discoverapi.DatastoreConfigData)
if !ok {
return types.InternalErrorf("incorrect data in datastore configuration: %v", data)
}
d.store, err = datastore.NewDa... | go | func (d *driver) initStore(option map[string]interface{}) error {
if data, ok := option[netlabel.LocalKVClient]; ok {
var err error
dsc, ok := data.(discoverapi.DatastoreConfigData)
if !ok {
return types.InternalErrorf("incorrect data in datastore configuration: %v", data)
}
d.store, err = datastore.NewDa... | [
"func",
"(",
"d",
"*",
"driver",
")",
"initStore",
"(",
"option",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"data",
",",
"ok",
":=",
"option",
"[",
"netlabel",
".",
"LocalKVClient",
"]",
";",
"ok",
"{",
"var",
"err"... | // initStore drivers are responsible for caching their own persistent state | [
"initStore",
"drivers",
"are",
"responsible",
"for",
"caching",
"their",
"own",
"persistent",
"state"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_store.go#L46-L62 |
22,309 | docker/libnetwork | drivers/macvlan/macvlan_store.go | populateNetworks | func (d *driver) populateNetworks() error {
kvol, err := d.store.List(datastore.Key(macvlanPrefix), &configuration{})
if err != nil && err != datastore.ErrKeyNotFound {
return fmt.Errorf("failed to get macvlan network configurations from store: %v", err)
}
// If empty it simply means no macvlan networks have been... | go | func (d *driver) populateNetworks() error {
kvol, err := d.store.List(datastore.Key(macvlanPrefix), &configuration{})
if err != nil && err != datastore.ErrKeyNotFound {
return fmt.Errorf("failed to get macvlan network configurations from store: %v", err)
}
// If empty it simply means no macvlan networks have been... | [
"func",
"(",
"d",
"*",
"driver",
")",
"populateNetworks",
"(",
")",
"error",
"{",
"kvol",
",",
"err",
":=",
"d",
".",
"store",
".",
"List",
"(",
"datastore",
".",
"Key",
"(",
"macvlanPrefix",
")",
",",
"&",
"configuration",
"{",
"}",
")",
"\n",
"if... | // populateNetworks is invoked at driver init to recreate persistently stored networks | [
"populateNetworks",
"is",
"invoked",
"at",
"driver",
"init",
"to",
"recreate",
"persistently",
"stored",
"networks"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_store.go#L65-L82 |
22,310 | docker/libnetwork | drivers/ipvlan/ipvlan_endpoint.go | CreateEndpoint | func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
epOptions map[string]interface{}) error {
defer osl.InitOSContext()()
if err := validateID(nid, eid); err != nil {
return err
}
n, err := d.getNetwork(nid)
if err != nil {
return fmt.Errorf("network id %q not found", nid)
}
if... | go | func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
epOptions map[string]interface{}) error {
defer osl.InitOSContext()()
if err := validateID(nid, eid); err != nil {
return err
}
n, err := d.getNetwork(nid)
if err != nil {
return fmt.Errorf("network id %q not found", nid)
}
if... | [
"func",
"(",
"d",
"*",
"driver",
")",
"CreateEndpoint",
"(",
"nid",
",",
"eid",
"string",
",",
"ifInfo",
"driverapi",
".",
"InterfaceInfo",
",",
"epOptions",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"defer",
"osl",
".",
"Ini... | // CreateEndpoint assigns the mac, ip and endpoint id for the new container | [
"CreateEndpoint",
"assigns",
"the",
"mac",
"ip",
"and",
"endpoint",
"id",
"for",
"the",
"new",
"container"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_endpoint.go#L15-L62 |
22,311 | docker/libnetwork | drivers/ipvlan/ipvlan_endpoint.go | DeleteEndpoint | func (d *driver) DeleteEndpoint(nid, eid string) error {
defer osl.InitOSContext()()
if err := validateID(nid, eid); err != nil {
return err
}
n := d.network(nid)
if n == nil {
return fmt.Errorf("network id %q not found", nid)
}
ep := n.endpoint(eid)
if ep == nil {
return fmt.Errorf("endpoint id %q not fo... | go | func (d *driver) DeleteEndpoint(nid, eid string) error {
defer osl.InitOSContext()()
if err := validateID(nid, eid); err != nil {
return err
}
n := d.network(nid)
if n == nil {
return fmt.Errorf("network id %q not found", nid)
}
ep := n.endpoint(eid)
if ep == nil {
return fmt.Errorf("endpoint id %q not fo... | [
"func",
"(",
"d",
"*",
"driver",
")",
"DeleteEndpoint",
"(",
"nid",
",",
"eid",
"string",
")",
"error",
"{",
"defer",
"osl",
".",
"InitOSContext",
"(",
")",
"(",
")",
"\n",
"if",
"err",
":=",
"validateID",
"(",
"nid",
",",
"eid",
")",
";",
"err",
... | // DeleteEndpoint remove the endpoint and associated netlink interface | [
"DeleteEndpoint",
"remove",
"the",
"endpoint",
"and",
"associated",
"netlink",
"interface"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_endpoint.go#L65-L89 |
22,312 | docker/libnetwork | osl/kernel/knobs_linux.go | ApplyOSTweaks | func ApplyOSTweaks(osConfig map[string]*OSValue) {
for k, v := range osConfig {
// read the existing property from disk
oldv, err := readSystemProperty(k)
if err != nil {
logrus.WithError(err).Errorf("error reading the kernel parameter %s", k)
continue
}
if propertyIsValid(oldv, v.Value, v.CheckFn) {
... | go | func ApplyOSTweaks(osConfig map[string]*OSValue) {
for k, v := range osConfig {
// read the existing property from disk
oldv, err := readSystemProperty(k)
if err != nil {
logrus.WithError(err).Errorf("error reading the kernel parameter %s", k)
continue
}
if propertyIsValid(oldv, v.Value, v.CheckFn) {
... | [
"func",
"ApplyOSTweaks",
"(",
"osConfig",
"map",
"[",
"string",
"]",
"*",
"OSValue",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"osConfig",
"{",
"// read the existing property from disk",
"oldv",
",",
"err",
":=",
"readSystemProperty",
"(",
"k",
")",
"\n... | // ApplyOSTweaks applies the configuration values passed as arguments | [
"ApplyOSTweaks",
"applies",
"the",
"configuration",
"values",
"passed",
"as",
"arguments"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/osl/kernel/knobs_linux.go#L29-L47 |
22,313 | docker/libnetwork | idm/idm.go | GetID | func (i *Idm) GetID(serial bool) (uint64, error) {
if i.handle == nil {
return 0, errors.New("ID set is not initialized")
}
ordinal, err := i.handle.SetAny(serial)
return i.start + ordinal, err
} | go | func (i *Idm) GetID(serial bool) (uint64, error) {
if i.handle == nil {
return 0, errors.New("ID set is not initialized")
}
ordinal, err := i.handle.SetAny(serial)
return i.start + ordinal, err
} | [
"func",
"(",
"i",
"*",
"Idm",
")",
"GetID",
"(",
"serial",
"bool",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"if",
"i",
".",
"handle",
"==",
"nil",
"{",
"return",
"0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"ordin... | // GetID returns the first available id in the set | [
"GetID",
"returns",
"the",
"first",
"available",
"id",
"in",
"the",
"set"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/idm/idm.go#L37-L43 |
22,314 | docker/libnetwork | idm/idm.go | GetSpecificID | func (i *Idm) GetSpecificID(id uint64) error {
if i.handle == nil {
return errors.New("ID set is not initialized")
}
if id < i.start || id > i.end {
return errors.New("Requested id does not belong to the set")
}
return i.handle.Set(id - i.start)
} | go | func (i *Idm) GetSpecificID(id uint64) error {
if i.handle == nil {
return errors.New("ID set is not initialized")
}
if id < i.start || id > i.end {
return errors.New("Requested id does not belong to the set")
}
return i.handle.Set(id - i.start)
} | [
"func",
"(",
"i",
"*",
"Idm",
")",
"GetSpecificID",
"(",
"id",
"uint64",
")",
"error",
"{",
"if",
"i",
".",
"handle",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"id",
"<",
"i",
".",
"start",... | // GetSpecificID tries to reserve the specified id | [
"GetSpecificID",
"tries",
"to",
"reserve",
"the",
"specified",
"id"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/idm/idm.go#L46-L56 |
22,315 | docker/libnetwork | idm/idm.go | Release | func (i *Idm) Release(id uint64) {
i.handle.Unset(id - i.start)
} | go | func (i *Idm) Release(id uint64) {
i.handle.Unset(id - i.start)
} | [
"func",
"(",
"i",
"*",
"Idm",
")",
"Release",
"(",
"id",
"uint64",
")",
"{",
"i",
".",
"handle",
".",
"Unset",
"(",
"id",
"-",
"i",
".",
"start",
")",
"\n",
"}"
] | // Release releases the specified id | [
"Release",
"releases",
"the",
"specified",
"id"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/idm/idm.go#L74-L76 |
22,316 | docker/libnetwork | types/types.go | Equal | func (t *TransportPort) Equal(o *TransportPort) bool {
if t == o {
return true
}
if o == nil {
return false
}
if t.Proto != o.Proto || t.Port != o.Port {
return false
}
return true
} | go | func (t *TransportPort) Equal(o *TransportPort) bool {
if t == o {
return true
}
if o == nil {
return false
}
if t.Proto != o.Proto || t.Port != o.Port {
return false
}
return true
} | [
"func",
"(",
"t",
"*",
"TransportPort",
")",
"Equal",
"(",
"o",
"*",
"TransportPort",
")",
"bool",
"{",
"if",
"t",
"==",
"o",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"t",
... | // Equal checks if this instance of Transportport is equal to the passed one | [
"Equal",
"checks",
"if",
"this",
"instance",
"of",
"Transportport",
"is",
"equal",
"to",
"the",
"passed",
"one"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L45-L59 |
22,317 | docker/libnetwork | types/types.go | GetCopy | func (t *TransportPort) GetCopy() TransportPort {
return TransportPort{Proto: t.Proto, Port: t.Port}
} | go | func (t *TransportPort) GetCopy() TransportPort {
return TransportPort{Proto: t.Proto, Port: t.Port}
} | [
"func",
"(",
"t",
"*",
"TransportPort",
")",
"GetCopy",
"(",
")",
"TransportPort",
"{",
"return",
"TransportPort",
"{",
"Proto",
":",
"t",
".",
"Proto",
",",
"Port",
":",
"t",
".",
"Port",
"}",
"\n",
"}"
] | // GetCopy returns a copy of this TransportPort structure instance | [
"GetCopy",
"returns",
"a",
"copy",
"of",
"this",
"TransportPort",
"structure",
"instance"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L62-L64 |
22,318 | docker/libnetwork | types/types.go | String | func (t *TransportPort) String() string {
return fmt.Sprintf("%s/%d", t.Proto.String(), t.Port)
} | go | func (t *TransportPort) String() string {
return fmt.Sprintf("%s/%d", t.Proto.String(), t.Port)
} | [
"func",
"(",
"t",
"*",
"TransportPort",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"Proto",
".",
"String",
"(",
")",
",",
"t",
".",
"Port",
")",
"\n",
"}"
] | // String returns the TransportPort structure in string form | [
"String",
"returns",
"the",
"TransportPort",
"structure",
"in",
"string",
"form"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L67-L69 |
22,319 | docker/libnetwork | types/types.go | FromString | func (t *TransportPort) FromString(s string) error {
ps := strings.Split(s, "/")
if len(ps) == 2 {
t.Proto = ParseProtocol(ps[0])
if p, err := strconv.ParseUint(ps[1], 10, 16); err == nil {
t.Port = uint16(p)
return nil
}
}
return BadRequestErrorf("invalid format for transport port: %s", s)
} | go | func (t *TransportPort) FromString(s string) error {
ps := strings.Split(s, "/")
if len(ps) == 2 {
t.Proto = ParseProtocol(ps[0])
if p, err := strconv.ParseUint(ps[1], 10, 16); err == nil {
t.Port = uint16(p)
return nil
}
}
return BadRequestErrorf("invalid format for transport port: %s", s)
} | [
"func",
"(",
"t",
"*",
"TransportPort",
")",
"FromString",
"(",
"s",
"string",
")",
"error",
"{",
"ps",
":=",
"strings",
".",
"Split",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"ps",
")",
"==",
"2",
"{",
"t",
".",
"Proto",
"=",
... | // FromString reads the TransportPort structure from string | [
"FromString",
"reads",
"the",
"TransportPort",
"structure",
"from",
"string"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L72-L82 |
22,320 | docker/libnetwork | types/types.go | HostAddr | func (p PortBinding) HostAddr() (net.Addr, error) {
switch p.Proto {
case UDP:
return &net.UDPAddr{IP: p.HostIP, Port: int(p.HostPort)}, nil
case TCP:
return &net.TCPAddr{IP: p.HostIP, Port: int(p.HostPort)}, nil
case SCTP:
return &sctp.SCTPAddr{IP: []net.IP{p.HostIP}, Port: int(p.HostPort)}, nil
default:
... | go | func (p PortBinding) HostAddr() (net.Addr, error) {
switch p.Proto {
case UDP:
return &net.UDPAddr{IP: p.HostIP, Port: int(p.HostPort)}, nil
case TCP:
return &net.TCPAddr{IP: p.HostIP, Port: int(p.HostPort)}, nil
case SCTP:
return &sctp.SCTPAddr{IP: []net.IP{p.HostIP}, Port: int(p.HostPort)}, nil
default:
... | [
"func",
"(",
"p",
"PortBinding",
")",
"HostAddr",
"(",
")",
"(",
"net",
".",
"Addr",
",",
"error",
")",
"{",
"switch",
"p",
".",
"Proto",
"{",
"case",
"UDP",
":",
"return",
"&",
"net",
".",
"UDPAddr",
"{",
"IP",
":",
"p",
".",
"HostIP",
",",
"P... | // HostAddr returns the host side transport address | [
"HostAddr",
"returns",
"the",
"host",
"side",
"transport",
"address"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L95-L106 |
22,321 | docker/libnetwork | types/types.go | GetCopy | func (p *PortBinding) GetCopy() PortBinding {
return PortBinding{
Proto: p.Proto,
IP: GetIPCopy(p.IP),
Port: p.Port,
HostIP: GetIPCopy(p.HostIP),
HostPort: p.HostPort,
HostPortEnd: p.HostPortEnd,
}
} | go | func (p *PortBinding) GetCopy() PortBinding {
return PortBinding{
Proto: p.Proto,
IP: GetIPCopy(p.IP),
Port: p.Port,
HostIP: GetIPCopy(p.HostIP),
HostPort: p.HostPort,
HostPortEnd: p.HostPortEnd,
}
} | [
"func",
"(",
"p",
"*",
"PortBinding",
")",
"GetCopy",
"(",
")",
"PortBinding",
"{",
"return",
"PortBinding",
"{",
"Proto",
":",
"p",
".",
"Proto",
",",
"IP",
":",
"GetIPCopy",
"(",
"p",
".",
"IP",
")",
",",
"Port",
":",
"p",
".",
"Port",
",",
"Ho... | // GetCopy returns a copy of this PortBinding structure instance | [
"GetCopy",
"returns",
"a",
"copy",
"of",
"this",
"PortBinding",
"structure",
"instance"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L123-L132 |
22,322 | docker/libnetwork | types/types.go | String | func (p *PortBinding) String() string {
ret := fmt.Sprintf("%s/", p.Proto)
if p.IP != nil {
ret += p.IP.String()
}
ret = fmt.Sprintf("%s:%d/", ret, p.Port)
if p.HostIP != nil {
ret += p.HostIP.String()
}
ret = fmt.Sprintf("%s:%d", ret, p.HostPort)
return ret
} | go | func (p *PortBinding) String() string {
ret := fmt.Sprintf("%s/", p.Proto)
if p.IP != nil {
ret += p.IP.String()
}
ret = fmt.Sprintf("%s:%d/", ret, p.Port)
if p.HostIP != nil {
ret += p.HostIP.String()
}
ret = fmt.Sprintf("%s:%d", ret, p.HostPort)
return ret
} | [
"func",
"(",
"p",
"*",
"PortBinding",
")",
"String",
"(",
")",
"string",
"{",
"ret",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"Proto",
")",
"\n",
"if",
"p",
".",
"IP",
"!=",
"nil",
"{",
"ret",
"+=",
"p",
".",
"IP",
".",
... | // String returns the PortBinding structure in string form | [
"String",
"returns",
"the",
"PortBinding",
"structure",
"in",
"string",
"form"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L135-L146 |
22,323 | docker/libnetwork | types/types.go | Equal | func (p *PortBinding) Equal(o *PortBinding) bool {
if p == o {
return true
}
if o == nil {
return false
}
if p.Proto != o.Proto || p.Port != o.Port ||
p.HostPort != o.HostPort || p.HostPortEnd != o.HostPortEnd {
return false
}
if p.IP != nil {
if !p.IP.Equal(o.IP) {
return false
}
} else {
i... | go | func (p *PortBinding) Equal(o *PortBinding) bool {
if p == o {
return true
}
if o == nil {
return false
}
if p.Proto != o.Proto || p.Port != o.Port ||
p.HostPort != o.HostPort || p.HostPortEnd != o.HostPortEnd {
return false
}
if p.IP != nil {
if !p.IP.Equal(o.IP) {
return false
}
} else {
i... | [
"func",
"(",
"p",
"*",
"PortBinding",
")",
"Equal",
"(",
"o",
"*",
"PortBinding",
")",
"bool",
"{",
"if",
"p",
"==",
"o",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"p",
".... | // Equal checks if this instance of PortBinding is equal to the passed one | [
"Equal",
"checks",
"if",
"this",
"instance",
"of",
"PortBinding",
"is",
"equal",
"to",
"the",
"passed",
"one"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L194-L229 |
22,324 | docker/libnetwork | types/types.go | ParseProtocol | func ParseProtocol(s string) Protocol {
switch strings.ToLower(s) {
case "icmp":
return ICMP
case "udp":
return UDP
case "tcp":
return TCP
case "sctp":
return SCTP
default:
return 0
}
} | go | func ParseProtocol(s string) Protocol {
switch strings.ToLower(s) {
case "icmp":
return ICMP
case "udp":
return UDP
case "tcp":
return TCP
case "sctp":
return SCTP
default:
return 0
}
} | [
"func",
"ParseProtocol",
"(",
"s",
"string",
")",
"Protocol",
"{",
"switch",
"strings",
".",
"ToLower",
"(",
"s",
")",
"{",
"case",
"\"",
"\"",
":",
"return",
"ICMP",
"\n",
"case",
"\"",
"\"",
":",
"return",
"UDP",
"\n",
"case",
"\"",
"\"",
":",
"r... | // ParseProtocol returns the respective Protocol type for the passed string | [
"ParseProtocol",
"returns",
"the",
"respective",
"Protocol",
"type",
"for",
"the",
"passed",
"string"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L268-L281 |
22,325 | docker/libnetwork | types/types.go | GetMacCopy | func GetMacCopy(from net.HardwareAddr) net.HardwareAddr {
if from == nil {
return nil
}
to := make(net.HardwareAddr, len(from))
copy(to, from)
return to
} | go | func GetMacCopy(from net.HardwareAddr) net.HardwareAddr {
if from == nil {
return nil
}
to := make(net.HardwareAddr, len(from))
copy(to, from)
return to
} | [
"func",
"GetMacCopy",
"(",
"from",
"net",
".",
"HardwareAddr",
")",
"net",
".",
"HardwareAddr",
"{",
"if",
"from",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"to",
":=",
"make",
"(",
"net",
".",
"HardwareAddr",
",",
"len",
"(",
"from",
")",
... | // GetMacCopy returns a copy of the passed MAC address | [
"GetMacCopy",
"returns",
"a",
"copy",
"of",
"the",
"passed",
"MAC",
"address"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L284-L291 |
22,326 | docker/libnetwork | types/types.go | GetIPCopy | func GetIPCopy(from net.IP) net.IP {
if from == nil {
return nil
}
to := make(net.IP, len(from))
copy(to, from)
return to
} | go | func GetIPCopy(from net.IP) net.IP {
if from == nil {
return nil
}
to := make(net.IP, len(from))
copy(to, from)
return to
} | [
"func",
"GetIPCopy",
"(",
"from",
"net",
".",
"IP",
")",
"net",
".",
"IP",
"{",
"if",
"from",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"to",
":=",
"make",
"(",
"net",
".",
"IP",
",",
"len",
"(",
"from",
")",
")",
"\n",
"copy",
"(",... | // GetIPCopy returns a copy of the passed IP address | [
"GetIPCopy",
"returns",
"a",
"copy",
"of",
"the",
"passed",
"IP",
"address"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L294-L301 |
22,327 | docker/libnetwork | types/types.go | GetIPNetCopy | func GetIPNetCopy(from *net.IPNet) *net.IPNet {
if from == nil {
return nil
}
bm := make(net.IPMask, len(from.Mask))
copy(bm, from.Mask)
return &net.IPNet{IP: GetIPCopy(from.IP), Mask: bm}
} | go | func GetIPNetCopy(from *net.IPNet) *net.IPNet {
if from == nil {
return nil
}
bm := make(net.IPMask, len(from.Mask))
copy(bm, from.Mask)
return &net.IPNet{IP: GetIPCopy(from.IP), Mask: bm}
} | [
"func",
"GetIPNetCopy",
"(",
"from",
"*",
"net",
".",
"IPNet",
")",
"*",
"net",
".",
"IPNet",
"{",
"if",
"from",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"bm",
":=",
"make",
"(",
"net",
".",
"IPMask",
",",
"len",
"(",
"from",
".",
"M... | // GetIPNetCopy returns a copy of the passed IP Network | [
"GetIPNetCopy",
"returns",
"a",
"copy",
"of",
"the",
"passed",
"IP",
"Network"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L304-L311 |
22,328 | docker/libnetwork | types/types.go | GetIPNetCanonical | func GetIPNetCanonical(nw *net.IPNet) *net.IPNet {
if nw == nil {
return nil
}
c := GetIPNetCopy(nw)
c.IP = c.IP.Mask(nw.Mask)
return c
} | go | func GetIPNetCanonical(nw *net.IPNet) *net.IPNet {
if nw == nil {
return nil
}
c := GetIPNetCopy(nw)
c.IP = c.IP.Mask(nw.Mask)
return c
} | [
"func",
"GetIPNetCanonical",
"(",
"nw",
"*",
"net",
".",
"IPNet",
")",
"*",
"net",
".",
"IPNet",
"{",
"if",
"nw",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"c",
":=",
"GetIPNetCopy",
"(",
"nw",
")",
"\n",
"c",
".",
"IP",
"=",
"c",
"."... | // GetIPNetCanonical returns the canonical form for the passed network | [
"GetIPNetCanonical",
"returns",
"the",
"canonical",
"form",
"for",
"the",
"passed",
"network"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L314-L321 |
22,329 | docker/libnetwork | types/types.go | CompareIPNet | func CompareIPNet(a, b *net.IPNet) bool {
if a == b {
return true
}
if a == nil || b == nil {
return false
}
return a.IP.Equal(b.IP) && bytes.Equal(a.Mask, b.Mask)
} | go | func CompareIPNet(a, b *net.IPNet) bool {
if a == b {
return true
}
if a == nil || b == nil {
return false
}
return a.IP.Equal(b.IP) && bytes.Equal(a.Mask, b.Mask)
} | [
"func",
"CompareIPNet",
"(",
"a",
",",
"b",
"*",
"net",
".",
"IPNet",
")",
"bool",
"{",
"if",
"a",
"==",
"b",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"a",
"==",
"nil",
"||",
"b",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"re... | // CompareIPNet returns equal if the two IP Networks are equal | [
"CompareIPNet",
"returns",
"equal",
"if",
"the",
"two",
"IP",
"Networks",
"are",
"equal"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L324-L332 |
22,330 | docker/libnetwork | types/types.go | GetMinimalIP | func GetMinimalIP(ip net.IP) net.IP {
if ip != nil && ip.To4() != nil {
return ip.To4()
}
return ip
} | go | func GetMinimalIP(ip net.IP) net.IP {
if ip != nil && ip.To4() != nil {
return ip.To4()
}
return ip
} | [
"func",
"GetMinimalIP",
"(",
"ip",
"net",
".",
"IP",
")",
"net",
".",
"IP",
"{",
"if",
"ip",
"!=",
"nil",
"&&",
"ip",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"return",
"ip",
".",
"To4",
"(",
")",
"\n",
"}",
"\n",
"return",
"ip",
"\n",
"}"
] | // GetMinimalIP returns the address in its shortest form
// If ip contains an IPv4-mapped IPv6 address, the 4-octet form of the IPv4 address will be returned.
// Otherwise ip is returned unchanged. | [
"GetMinimalIP",
"returns",
"the",
"address",
"in",
"its",
"shortest",
"form",
"If",
"ip",
"contains",
"an",
"IPv4",
"-",
"mapped",
"IPv6",
"address",
"the",
"4",
"-",
"octet",
"form",
"of",
"the",
"IPv4",
"address",
"will",
"be",
"returned",
".",
"Otherwis... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L337-L342 |
22,331 | docker/libnetwork | types/types.go | GetMinimalIPNet | func GetMinimalIPNet(nw *net.IPNet) *net.IPNet {
if nw == nil {
return nil
}
if len(nw.IP) == 16 && nw.IP.To4() != nil {
m := nw.Mask
if len(m) == 16 {
m = m[12:16]
}
return &net.IPNet{IP: nw.IP.To4(), Mask: m}
}
return nw
} | go | func GetMinimalIPNet(nw *net.IPNet) *net.IPNet {
if nw == nil {
return nil
}
if len(nw.IP) == 16 && nw.IP.To4() != nil {
m := nw.Mask
if len(m) == 16 {
m = m[12:16]
}
return &net.IPNet{IP: nw.IP.To4(), Mask: m}
}
return nw
} | [
"func",
"GetMinimalIPNet",
"(",
"nw",
"*",
"net",
".",
"IPNet",
")",
"*",
"net",
".",
"IPNet",
"{",
"if",
"nw",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"len",
"(",
"nw",
".",
"IP",
")",
"==",
"16",
"&&",
"nw",
".",
"IP",
"."... | // GetMinimalIPNet returns a copy of the passed IP Network with congruent ip and mask notation | [
"GetMinimalIPNet",
"returns",
"a",
"copy",
"of",
"the",
"passed",
"IP",
"Network",
"with",
"congruent",
"ip",
"and",
"mask",
"notation"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L345-L357 |
22,332 | docker/libnetwork | types/types.go | compareIPMask | func compareIPMask(ip net.IP, mask net.IPMask) (is int, ms int, err error) {
// Find the effective starting of address and mask
if len(ip) == net.IPv6len && ip.To4() != nil {
is = 12
}
if len(ip[is:]) == net.IPv4len && len(mask) == net.IPv6len && bytes.Equal(mask[:12], v4inV6MaskPrefix) {
ms = 12
}
// Check i... | go | func compareIPMask(ip net.IP, mask net.IPMask) (is int, ms int, err error) {
// Find the effective starting of address and mask
if len(ip) == net.IPv6len && ip.To4() != nil {
is = 12
}
if len(ip[is:]) == net.IPv4len && len(mask) == net.IPv6len && bytes.Equal(mask[:12], v4inV6MaskPrefix) {
ms = 12
}
// Check i... | [
"func",
"compareIPMask",
"(",
"ip",
"net",
".",
"IP",
",",
"mask",
"net",
".",
"IPMask",
")",
"(",
"is",
"int",
",",
"ms",
"int",
",",
"err",
"error",
")",
"{",
"// Find the effective starting of address and mask",
"if",
"len",
"(",
"ip",
")",
"==",
"net... | // compareIPMask checks if the passed ip and mask are semantically compatible.
// It returns the byte indexes for the address and mask so that caller can
// do bitwise operations without modifying address representation. | [
"compareIPMask",
"checks",
"if",
"the",
"passed",
"ip",
"and",
"mask",
"are",
"semantically",
"compatible",
".",
"It",
"returns",
"the",
"byte",
"indexes",
"for",
"the",
"address",
"and",
"mask",
"so",
"that",
"caller",
"can",
"do",
"bitwise",
"operations",
... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L370-L383 |
22,333 | docker/libnetwork | types/types.go | GetHostPartIP | func GetHostPartIP(ip net.IP, mask net.IPMask) (net.IP, error) {
// Find the effective starting of address and mask
is, ms, err := compareIPMask(ip, mask)
if err != nil {
return nil, fmt.Errorf("cannot compute host portion ip address because %s", err)
}
// Compute host portion
out := GetIPCopy(ip)
for i := 0;... | go | func GetHostPartIP(ip net.IP, mask net.IPMask) (net.IP, error) {
// Find the effective starting of address and mask
is, ms, err := compareIPMask(ip, mask)
if err != nil {
return nil, fmt.Errorf("cannot compute host portion ip address because %s", err)
}
// Compute host portion
out := GetIPCopy(ip)
for i := 0;... | [
"func",
"GetHostPartIP",
"(",
"ip",
"net",
".",
"IP",
",",
"mask",
"net",
".",
"IPMask",
")",
"(",
"net",
".",
"IP",
",",
"error",
")",
"{",
"// Find the effective starting of address and mask",
"is",
",",
"ms",
",",
"err",
":=",
"compareIPMask",
"(",
"ip"... | // GetHostPartIP returns the host portion of the ip address identified by the mask.
// IP address representation is not modified. If address and mask are not compatible
// an error is returned. | [
"GetHostPartIP",
"returns",
"the",
"host",
"portion",
"of",
"the",
"ip",
"address",
"identified",
"by",
"the",
"mask",
".",
"IP",
"address",
"representation",
"is",
"not",
"modified",
".",
"If",
"address",
"and",
"mask",
"are",
"not",
"compatible",
"an",
"er... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L388-L402 |
22,334 | docker/libnetwork | types/types.go | GetCopy | func (r *StaticRoute) GetCopy() *StaticRoute {
d := GetIPNetCopy(r.Destination)
nh := GetIPCopy(r.NextHop)
return &StaticRoute{Destination: d,
RouteType: r.RouteType,
NextHop: nh,
}
} | go | func (r *StaticRoute) GetCopy() *StaticRoute {
d := GetIPNetCopy(r.Destination)
nh := GetIPCopy(r.NextHop)
return &StaticRoute{Destination: d,
RouteType: r.RouteType,
NextHop: nh,
}
} | [
"func",
"(",
"r",
"*",
"StaticRoute",
")",
"GetCopy",
"(",
")",
"*",
"StaticRoute",
"{",
"d",
":=",
"GetIPNetCopy",
"(",
"r",
".",
"Destination",
")",
"\n",
"nh",
":=",
"GetIPCopy",
"(",
"r",
".",
"NextHop",
")",
"\n",
"return",
"&",
"StaticRoute",
"... | // GetCopy returns a copy of this StaticRoute structure | [
"GetCopy",
"returns",
"a",
"copy",
"of",
"this",
"StaticRoute",
"structure"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L451-L458 |
22,335 | docker/libnetwork | types/types.go | NotFoundErrorf | func NotFoundErrorf(format string, params ...interface{}) error {
return notFound(fmt.Sprintf(format, params...))
} | go | func NotFoundErrorf(format string, params ...interface{}) error {
return notFound(fmt.Sprintf(format, params...))
} | [
"func",
"NotFoundErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"notFound",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // NotFoundErrorf creates an instance of NotFoundError | [
"NotFoundErrorf",
"creates",
"an",
"instance",
"of",
"NotFoundError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L545-L547 |
22,336 | docker/libnetwork | types/types.go | ForbiddenErrorf | func ForbiddenErrorf(format string, params ...interface{}) error {
return forbidden(fmt.Sprintf(format, params...))
} | go | func ForbiddenErrorf(format string, params ...interface{}) error {
return forbidden(fmt.Sprintf(format, params...))
} | [
"func",
"ForbiddenErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"forbidden",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // ForbiddenErrorf creates an instance of ForbiddenError | [
"ForbiddenErrorf",
"creates",
"an",
"instance",
"of",
"ForbiddenError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L550-L552 |
22,337 | docker/libnetwork | types/types.go | NoServiceErrorf | func NoServiceErrorf(format string, params ...interface{}) error {
return noService(fmt.Sprintf(format, params...))
} | go | func NoServiceErrorf(format string, params ...interface{}) error {
return noService(fmt.Sprintf(format, params...))
} | [
"func",
"NoServiceErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"noService",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // NoServiceErrorf creates an instance of NoServiceError | [
"NoServiceErrorf",
"creates",
"an",
"instance",
"of",
"NoServiceError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L555-L557 |
22,338 | docker/libnetwork | types/types.go | NotImplementedErrorf | func NotImplementedErrorf(format string, params ...interface{}) error {
return notImpl(fmt.Sprintf(format, params...))
} | go | func NotImplementedErrorf(format string, params ...interface{}) error {
return notImpl(fmt.Sprintf(format, params...))
} | [
"func",
"NotImplementedErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"notImpl",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // NotImplementedErrorf creates an instance of NotImplementedError | [
"NotImplementedErrorf",
"creates",
"an",
"instance",
"of",
"NotImplementedError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L560-L562 |
22,339 | docker/libnetwork | types/types.go | TimeoutErrorf | func TimeoutErrorf(format string, params ...interface{}) error {
return timeout(fmt.Sprintf(format, params...))
} | go | func TimeoutErrorf(format string, params ...interface{}) error {
return timeout(fmt.Sprintf(format, params...))
} | [
"func",
"TimeoutErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"timeout",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // TimeoutErrorf creates an instance of TimeoutError | [
"TimeoutErrorf",
"creates",
"an",
"instance",
"of",
"TimeoutError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L565-L567 |
22,340 | docker/libnetwork | types/types.go | InternalErrorf | func InternalErrorf(format string, params ...interface{}) error {
return internal(fmt.Sprintf(format, params...))
} | go | func InternalErrorf(format string, params ...interface{}) error {
return internal(fmt.Sprintf(format, params...))
} | [
"func",
"InternalErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"internal",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // InternalErrorf creates an instance of InternalError | [
"InternalErrorf",
"creates",
"an",
"instance",
"of",
"InternalError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L570-L572 |
22,341 | docker/libnetwork | types/types.go | InternalMaskableErrorf | func InternalMaskableErrorf(format string, params ...interface{}) error {
return maskInternal(fmt.Sprintf(format, params...))
} | go | func InternalMaskableErrorf(format string, params ...interface{}) error {
return maskInternal(fmt.Sprintf(format, params...))
} | [
"func",
"InternalMaskableErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"maskInternal",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // InternalMaskableErrorf creates an instance of InternalError and MaskableError | [
"InternalMaskableErrorf",
"creates",
"an",
"instance",
"of",
"InternalError",
"and",
"MaskableError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L575-L577 |
22,342 | docker/libnetwork | types/types.go | RetryErrorf | func RetryErrorf(format string, params ...interface{}) error {
return retry(fmt.Sprintf(format, params...))
} | go | func RetryErrorf(format string, params ...interface{}) error {
return retry(fmt.Sprintf(format, params...))
} | [
"func",
"RetryErrorf",
"(",
"format",
"string",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"retry",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"params",
"...",
")",
")",
"\n",
"}"
] | // RetryErrorf creates an instance of RetryError | [
"RetryErrorf",
"creates",
"an",
"instance",
"of",
"RetryError"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/types/types.go#L580-L582 |
22,343 | docker/libnetwork | drivers/macvlan/macvlan_state.go | getNetworks | func (d *driver) getNetworks() []*network {
d.Lock()
defer d.Unlock()
ls := make([]*network, 0, len(d.networks))
for _, nw := range d.networks {
ls = append(ls, nw)
}
return ls
} | go | func (d *driver) getNetworks() []*network {
d.Lock()
defer d.Unlock()
ls := make([]*network, 0, len(d.networks))
for _, nw := range d.networks {
ls = append(ls, nw)
}
return ls
} | [
"func",
"(",
"d",
"*",
"driver",
")",
"getNetworks",
"(",
")",
"[",
"]",
"*",
"network",
"{",
"d",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"Unlock",
"(",
")",
"\n\n",
"ls",
":=",
"make",
"(",
"[",
"]",
"*",
"network",
",",
"0",
",",
... | // getNetworks Safely returns a slice of existing networks | [
"getNetworks",
"Safely",
"returns",
"a",
"slice",
"of",
"existing",
"networks"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/macvlan/macvlan_state.go#L35-L45 |
22,344 | docker/libnetwork | config/config.go | LoadDefaultScopes | func (c *Config) LoadDefaultScopes(dataDir string) {
for k, v := range datastore.DefaultScopes(dataDir) {
if _, ok := c.Scopes[k]; !ok {
c.Scopes[k] = v
}
}
} | go | func (c *Config) LoadDefaultScopes(dataDir string) {
for k, v := range datastore.DefaultScopes(dataDir) {
if _, ok := c.Scopes[k]; !ok {
c.Scopes[k] = v
}
}
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"LoadDefaultScopes",
"(",
"dataDir",
"string",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"datastore",
".",
"DefaultScopes",
"(",
"dataDir",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"c",
".",
"Scopes",
"[",
"k... | // LoadDefaultScopes loads default scope configs for scopes which
// doesn't have explicit user specified configs. | [
"LoadDefaultScopes",
"loads",
"default",
"scope",
"configs",
"for",
"scopes",
"which",
"doesn",
"t",
"have",
"explicit",
"user",
"specified",
"configs",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L58-L64 |
22,345 | docker/libnetwork | config/config.go | ParseConfigOptions | func ParseConfigOptions(cfgOptions ...Option) *Config {
cfg := &Config{
Daemon: DaemonCfg{
DriverCfg: make(map[string]interface{}),
},
Scopes: make(map[string]*datastore.ScopeCfg),
}
cfg.ProcessOptions(cfgOptions...)
cfg.LoadDefaultScopes(cfg.Daemon.DataDir)
return cfg
} | go | func ParseConfigOptions(cfgOptions ...Option) *Config {
cfg := &Config{
Daemon: DaemonCfg{
DriverCfg: make(map[string]interface{}),
},
Scopes: make(map[string]*datastore.ScopeCfg),
}
cfg.ProcessOptions(cfgOptions...)
cfg.LoadDefaultScopes(cfg.Daemon.DataDir)
return cfg
} | [
"func",
"ParseConfigOptions",
"(",
"cfgOptions",
"...",
"Option",
")",
"*",
"Config",
"{",
"cfg",
":=",
"&",
"Config",
"{",
"Daemon",
":",
"DaemonCfg",
"{",
"DriverCfg",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
",",
"}",... | // ParseConfigOptions parses the configuration options and returns
// a reference to the corresponding Config structure | [
"ParseConfigOptions",
"parses",
"the",
"configuration",
"options",
"and",
"returns",
"a",
"reference",
"to",
"the",
"corresponding",
"Config",
"structure"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L82-L94 |
22,346 | docker/libnetwork | config/config.go | OptionDefaultNetwork | func OptionDefaultNetwork(dn string) Option {
return func(c *Config) {
logrus.Debugf("Option DefaultNetwork: %s", dn)
c.Daemon.DefaultNetwork = strings.TrimSpace(dn)
}
} | go | func OptionDefaultNetwork(dn string) Option {
return func(c *Config) {
logrus.Debugf("Option DefaultNetwork: %s", dn)
c.Daemon.DefaultNetwork = strings.TrimSpace(dn)
}
} | [
"func",
"OptionDefaultNetwork",
"(",
"dn",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dn",
")",
"\n",
"c",
".",
"Daemon",
".",
"DefaultNetwork",
"=",
"strings",
"... | // OptionDefaultNetwork function returns an option setter for a default network | [
"OptionDefaultNetwork",
"function",
"returns",
"an",
"option",
"setter",
"for",
"a",
"default",
"network"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L101-L106 |
22,347 | docker/libnetwork | config/config.go | OptionDefaultDriver | func OptionDefaultDriver(dd string) Option {
return func(c *Config) {
logrus.Debugf("Option DefaultDriver: %s", dd)
c.Daemon.DefaultDriver = strings.TrimSpace(dd)
}
} | go | func OptionDefaultDriver(dd string) Option {
return func(c *Config) {
logrus.Debugf("Option DefaultDriver: %s", dd)
c.Daemon.DefaultDriver = strings.TrimSpace(dd)
}
} | [
"func",
"OptionDefaultDriver",
"(",
"dd",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dd",
")",
"\n",
"c",
".",
"Daemon",
".",
"DefaultDriver",
"=",
"strings",
"."... | // OptionDefaultDriver function returns an option setter for default driver | [
"OptionDefaultDriver",
"function",
"returns",
"an",
"option",
"setter",
"for",
"default",
"driver"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L109-L114 |
22,348 | docker/libnetwork | config/config.go | OptionDefaultAddressPoolConfig | func OptionDefaultAddressPoolConfig(addressPool []*ipamutils.NetworkToSplit) Option {
return func(c *Config) {
c.Daemon.DefaultAddressPool = addressPool
}
} | go | func OptionDefaultAddressPoolConfig(addressPool []*ipamutils.NetworkToSplit) Option {
return func(c *Config) {
c.Daemon.DefaultAddressPool = addressPool
}
} | [
"func",
"OptionDefaultAddressPoolConfig",
"(",
"addressPool",
"[",
"]",
"*",
"ipamutils",
".",
"NetworkToSplit",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"Daemon",
".",
"DefaultAddressPool",
"=",
"addressPool",
"\n",
... | // OptionDefaultAddressPoolConfig function returns an option setter for default address pool | [
"OptionDefaultAddressPoolConfig",
"function",
"returns",
"an",
"option",
"setter",
"for",
"default",
"address",
"pool"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L117-L121 |
22,349 | docker/libnetwork | config/config.go | OptionDriverConfig | func OptionDriverConfig(networkType string, config map[string]interface{}) Option {
return func(c *Config) {
c.Daemon.DriverCfg[networkType] = config
}
} | go | func OptionDriverConfig(networkType string, config map[string]interface{}) Option {
return func(c *Config) {
c.Daemon.DriverCfg[networkType] = config
}
} | [
"func",
"OptionDriverConfig",
"(",
"networkType",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"Daemon",
".",
"DriverCfg",
"[",
"networkType"... | // OptionDriverConfig returns an option setter for driver configuration. | [
"OptionDriverConfig",
"returns",
"an",
"option",
"setter",
"for",
"driver",
"configuration",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L124-L128 |
22,350 | docker/libnetwork | config/config.go | OptionLabels | func OptionLabels(labels []string) Option {
return func(c *Config) {
for _, label := range labels {
if strings.HasPrefix(label, netlabel.Prefix) {
c.Daemon.Labels = append(c.Daemon.Labels, label)
}
}
}
} | go | func OptionLabels(labels []string) Option {
return func(c *Config) {
for _, label := range labels {
if strings.HasPrefix(label, netlabel.Prefix) {
c.Daemon.Labels = append(c.Daemon.Labels, label)
}
}
}
} | [
"func",
"OptionLabels",
"(",
"labels",
"[",
"]",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"for",
"_",
",",
"label",
":=",
"range",
"labels",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"label",
",",
"netlabe... | // OptionLabels function returns an option setter for labels | [
"OptionLabels",
"function",
"returns",
"an",
"option",
"setter",
"for",
"labels"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L131-L139 |
22,351 | docker/libnetwork | config/config.go | OptionKVProvider | func OptionKVProvider(provider string) Option {
return func(c *Config) {
logrus.Debugf("Option OptionKVProvider: %s", provider)
if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
c.Scopes[datastore.GlobalScope] = &datastore.ScopeCfg{}
}
c.Scopes[datastore.GlobalScope].Client.Provider = strings.TrimSpace(pro... | go | func OptionKVProvider(provider string) Option {
return func(c *Config) {
logrus.Debugf("Option OptionKVProvider: %s", provider)
if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
c.Scopes[datastore.GlobalScope] = &datastore.ScopeCfg{}
}
c.Scopes[datastore.GlobalScope].Client.Provider = strings.TrimSpace(pro... | [
"func",
"OptionKVProvider",
"(",
"provider",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"provider",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"c",
".",
"Scopes",
"[... | // OptionKVProvider function returns an option setter for kvstore provider | [
"OptionKVProvider",
"function",
"returns",
"an",
"option",
"setter",
"for",
"kvstore",
"provider"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L142-L150 |
22,352 | docker/libnetwork | config/config.go | OptionKVProviderURL | func OptionKVProviderURL(url string) Option {
return func(c *Config) {
logrus.Debugf("Option OptionKVProviderURL: %s", url)
if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
c.Scopes[datastore.GlobalScope] = &datastore.ScopeCfg{}
}
c.Scopes[datastore.GlobalScope].Client.Address = strings.TrimSpace(url)
}
... | go | func OptionKVProviderURL(url string) Option {
return func(c *Config) {
logrus.Debugf("Option OptionKVProviderURL: %s", url)
if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
c.Scopes[datastore.GlobalScope] = &datastore.ScopeCfg{}
}
c.Scopes[datastore.GlobalScope].Client.Address = strings.TrimSpace(url)
}
... | [
"func",
"OptionKVProviderURL",
"(",
"url",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"url",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"c",
".",
"Scopes",
"[",
"d... | // OptionKVProviderURL function returns an option setter for kvstore url | [
"OptionKVProviderURL",
"function",
"returns",
"an",
"option",
"setter",
"for",
"kvstore",
"url"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L153-L161 |
22,353 | docker/libnetwork | config/config.go | OptionKVOpts | func OptionKVOpts(opts map[string]string) Option {
return func(c *Config) {
if opts["kv.cacertfile"] != "" && opts["kv.certfile"] != "" && opts["kv.keyfile"] != "" {
logrus.Info("Option Initializing KV with TLS")
tlsConfig, err := tlsconfig.Client(tlsconfig.Options{
CAFile: opts["kv.cacertfile"],
Cer... | go | func OptionKVOpts(opts map[string]string) Option {
return func(c *Config) {
if opts["kv.cacertfile"] != "" && opts["kv.certfile"] != "" && opts["kv.keyfile"] != "" {
logrus.Info("Option Initializing KV with TLS")
tlsConfig, err := tlsconfig.Client(tlsconfig.Options{
CAFile: opts["kv.cacertfile"],
Cer... | [
"func",
"OptionKVOpts",
"(",
"opts",
"map",
"[",
"string",
"]",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"if",
"opts",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"&&",
"opts",
"[",
"\"",
"\"",
"]",
"!=",
"... | // OptionKVOpts function returns an option setter for kvstore options | [
"OptionKVOpts",
"function",
"returns",
"an",
"option",
"setter",
"for",
"kvstore",
"options"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L164-L195 |
22,354 | docker/libnetwork | config/config.go | OptionDiscoveryWatcher | func OptionDiscoveryWatcher(watcher discovery.Watcher) Option {
return func(c *Config) {
c.Cluster.Watcher = watcher
}
} | go | func OptionDiscoveryWatcher(watcher discovery.Watcher) Option {
return func(c *Config) {
c.Cluster.Watcher = watcher
}
} | [
"func",
"OptionDiscoveryWatcher",
"(",
"watcher",
"discovery",
".",
"Watcher",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"Cluster",
".",
"Watcher",
"=",
"watcher",
"\n",
"}",
"\n",
"}"
] | // OptionDiscoveryWatcher function returns an option setter for discovery watcher | [
"OptionDiscoveryWatcher",
"function",
"returns",
"an",
"option",
"setter",
"for",
"discovery",
"watcher"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L198-L202 |
22,355 | docker/libnetwork | config/config.go | OptionDiscoveryAddress | func OptionDiscoveryAddress(address string) Option {
return func(c *Config) {
c.Cluster.Address = address
}
} | go | func OptionDiscoveryAddress(address string) Option {
return func(c *Config) {
c.Cluster.Address = address
}
} | [
"func",
"OptionDiscoveryAddress",
"(",
"address",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"Cluster",
".",
"Address",
"=",
"address",
"\n",
"}",
"\n",
"}"
] | // OptionDiscoveryAddress function returns an option setter for self discovery address | [
"OptionDiscoveryAddress",
"function",
"returns",
"an",
"option",
"setter",
"for",
"self",
"discovery",
"address"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L205-L209 |
22,356 | docker/libnetwork | config/config.go | OptionDataDir | func OptionDataDir(dataDir string) Option {
return func(c *Config) {
c.Daemon.DataDir = dataDir
}
} | go | func OptionDataDir(dataDir string) Option {
return func(c *Config) {
c.Daemon.DataDir = dataDir
}
} | [
"func",
"OptionDataDir",
"(",
"dataDir",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"Daemon",
".",
"DataDir",
"=",
"dataDir",
"\n",
"}",
"\n",
"}"
] | // OptionDataDir function returns an option setter for data folder | [
"OptionDataDir",
"function",
"returns",
"an",
"option",
"setter",
"for",
"data",
"folder"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L212-L216 |
22,357 | docker/libnetwork | config/config.go | OptionExecRoot | func OptionExecRoot(execRoot string) Option {
return func(c *Config) {
c.Daemon.ExecRoot = execRoot
osl.SetBasePath(execRoot)
}
} | go | func OptionExecRoot(execRoot string) Option {
return func(c *Config) {
c.Daemon.ExecRoot = execRoot
osl.SetBasePath(execRoot)
}
} | [
"func",
"OptionExecRoot",
"(",
"execRoot",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"Daemon",
".",
"ExecRoot",
"=",
"execRoot",
"\n",
"osl",
".",
"SetBasePath",
"(",
"execRoot",
")",
"\n",
"}",
"\n",
... | // OptionExecRoot function returns an option setter for exec root folder | [
"OptionExecRoot",
"function",
"returns",
"an",
"option",
"setter",
"for",
"exec",
"root",
"folder"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L219-L224 |
22,358 | docker/libnetwork | config/config.go | OptionPluginGetter | func OptionPluginGetter(pg plugingetter.PluginGetter) Option {
return func(c *Config) {
c.PluginGetter = pg
}
} | go | func OptionPluginGetter(pg plugingetter.PluginGetter) Option {
return func(c *Config) {
c.PluginGetter = pg
}
} | [
"func",
"OptionPluginGetter",
"(",
"pg",
"plugingetter",
".",
"PluginGetter",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"PluginGetter",
"=",
"pg",
"\n",
"}",
"\n",
"}"
] | // OptionPluginGetter returns a plugingetter for remote drivers. | [
"OptionPluginGetter",
"returns",
"a",
"plugingetter",
"for",
"remote",
"drivers",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L227-L231 |
22,359 | docker/libnetwork | config/config.go | OptionExperimental | func OptionExperimental(exp bool) Option {
return func(c *Config) {
logrus.Debugf("Option Experimental: %v", exp)
c.Daemon.Experimental = exp
}
} | go | func OptionExperimental(exp bool) Option {
return func(c *Config) {
logrus.Debugf("Option Experimental: %v", exp)
c.Daemon.Experimental = exp
}
} | [
"func",
"OptionExperimental",
"(",
"exp",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"exp",
")",
"\n",
"c",
".",
"Daemon",
".",
"Experimental",
"=",
"exp",
"\n",
"... | // OptionExperimental function returns an option setter for experimental daemon | [
"OptionExperimental",
"function",
"returns",
"an",
"option",
"setter",
"for",
"experimental",
"daemon"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L234-L239 |
22,360 | docker/libnetwork | config/config.go | OptionNetworkControlPlaneMTU | func OptionNetworkControlPlaneMTU(exp int) Option {
return func(c *Config) {
logrus.Debugf("Network Control Plane MTU: %d", exp)
if exp < warningThNetworkControlPlaneMTU {
logrus.Warnf("Received a MTU of %d, this value is very low, the network control plane can misbehave,"+
" defaulting to minimum value (%d... | go | func OptionNetworkControlPlaneMTU(exp int) Option {
return func(c *Config) {
logrus.Debugf("Network Control Plane MTU: %d", exp)
if exp < warningThNetworkControlPlaneMTU {
logrus.Warnf("Received a MTU of %d, this value is very low, the network control plane can misbehave,"+
" defaulting to minimum value (%d... | [
"func",
"OptionNetworkControlPlaneMTU",
"(",
"exp",
"int",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"exp",
")",
"\n",
"if",
"exp",
"<",
"warningThNetworkControlPlaneMTU",
"{",
... | // OptionNetworkControlPlaneMTU function returns an option setter for control plane MTU | [
"OptionNetworkControlPlaneMTU",
"function",
"returns",
"an",
"option",
"setter",
"for",
"control",
"plane",
"MTU"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L242-L254 |
22,361 | docker/libnetwork | config/config.go | ProcessOptions | func (c *Config) ProcessOptions(options ...Option) {
for _, opt := range options {
if opt != nil {
opt(c)
}
}
} | go | func (c *Config) ProcessOptions(options ...Option) {
for _, opt := range options {
if opt != nil {
opt(c)
}
}
} | [
"func",
"(",
"c",
"*",
"Config",
")",
"ProcessOptions",
"(",
"options",
"...",
"Option",
")",
"{",
"for",
"_",
",",
"opt",
":=",
"range",
"options",
"{",
"if",
"opt",
"!=",
"nil",
"{",
"opt",
"(",
"c",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] | // ProcessOptions processes options and stores it in config | [
"ProcessOptions",
"processes",
"options",
"and",
"stores",
"it",
"in",
"config"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L257-L263 |
22,362 | docker/libnetwork | config/config.go | OptionLocalKVProviderConfig | func OptionLocalKVProviderConfig(config *store.Config) Option {
return func(c *Config) {
logrus.Debugf("Option OptionLocalKVProviderConfig: %v", config)
if _, ok := c.Scopes[datastore.LocalScope]; !ok {
c.Scopes[datastore.LocalScope] = &datastore.ScopeCfg{}
}
c.Scopes[datastore.LocalScope].Client.Config = c... | go | func OptionLocalKVProviderConfig(config *store.Config) Option {
return func(c *Config) {
logrus.Debugf("Option OptionLocalKVProviderConfig: %v", config)
if _, ok := c.Scopes[datastore.LocalScope]; !ok {
c.Scopes[datastore.LocalScope] = &datastore.ScopeCfg{}
}
c.Scopes[datastore.LocalScope].Client.Config = c... | [
"func",
"OptionLocalKVProviderConfig",
"(",
"config",
"*",
"store",
".",
"Config",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"config",
")",
"\n",
"if",
"_",
",",
"ok",
":="... | // OptionLocalKVProviderConfig function returns an option setter for kvstore config | [
"OptionLocalKVProviderConfig",
"function",
"returns",
"an",
"option",
"setter",
"for",
"kvstore",
"config"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/config/config.go#L293-L301 |
22,363 | docker/libnetwork | iptables/firewalld.go | FirewalldInit | func FirewalldInit() error {
var err error
if connection, err = newConnection(); err != nil {
return fmt.Errorf("Failed to connect to D-Bus system bus: %v", err)
}
firewalldRunning = checkRunning()
if !firewalldRunning {
connection.sysconn.Close()
connection = nil
}
if connection != nil {
go signalHandl... | go | func FirewalldInit() error {
var err error
if connection, err = newConnection(); err != nil {
return fmt.Errorf("Failed to connect to D-Bus system bus: %v", err)
}
firewalldRunning = checkRunning()
if !firewalldRunning {
connection.sysconn.Close()
connection = nil
}
if connection != nil {
go signalHandl... | [
"func",
"FirewalldInit",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"if",
"connection",
",",
"err",
"=",
"newConnection",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}... | // FirewalldInit initializes firewalld management code. | [
"FirewalldInit",
"initializes",
"firewalld",
"management",
"code",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/firewalld.go#L41-L57 |
22,364 | docker/libnetwork | iptables/firewalld.go | initConnection | func (c *Conn) initConnection() error {
var err error
c.sysconn, err = dbus.SystemBus()
if err != nil {
return err
}
// This never fails, even if the service is not running atm.
c.sysobj = c.sysconn.Object(dbusInterface, dbus.ObjectPath(dbusPath))
rule := fmt.Sprintf("type='signal',path='%s',interface='%s',... | go | func (c *Conn) initConnection() error {
var err error
c.sysconn, err = dbus.SystemBus()
if err != nil {
return err
}
// This never fails, even if the service is not running atm.
c.sysobj = c.sysconn.Object(dbusInterface, dbus.ObjectPath(dbusPath))
rule := fmt.Sprintf("type='signal',path='%s',interface='%s',... | [
"func",
"(",
"c",
"*",
"Conn",
")",
"initConnection",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"c",
".",
"sysconn",
",",
"err",
"=",
"dbus",
".",
"SystemBus",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}"... | // Initialize D-Bus connection. | [
"Initialize",
"D",
"-",
"Bus",
"connection",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/firewalld.go#L70-L93 |
22,365 | docker/libnetwork | iptables/firewalld.go | OnReloaded | func OnReloaded(callback func()) {
for _, pf := range onReloaded {
if pf == &callback {
return
}
}
onReloaded = append(onReloaded, &callback)
} | go | func OnReloaded(callback func()) {
for _, pf := range onReloaded {
if pf == &callback {
return
}
}
onReloaded = append(onReloaded, &callback)
} | [
"func",
"OnReloaded",
"(",
"callback",
"func",
"(",
")",
")",
"{",
"for",
"_",
",",
"pf",
":=",
"range",
"onReloaded",
"{",
"if",
"pf",
"==",
"&",
"callback",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"onReloaded",
"=",
"append",
"(",
"onReloaded",
... | // OnReloaded add callback | [
"OnReloaded",
"add",
"callback"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/firewalld.go#L138-L145 |
22,366 | docker/libnetwork | iptables/firewalld.go | checkRunning | func checkRunning() bool {
var zone string
var err error
if connection != nil {
err = connection.sysobj.Call(dbusInterface+".getDefaultZone", 0).Store(&zone)
return err == nil
}
return false
} | go | func checkRunning() bool {
var zone string
var err error
if connection != nil {
err = connection.sysobj.Call(dbusInterface+".getDefaultZone", 0).Store(&zone)
return err == nil
}
return false
} | [
"func",
"checkRunning",
"(",
")",
"bool",
"{",
"var",
"zone",
"string",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"connection",
"!=",
"nil",
"{",
"err",
"=",
"connection",
".",
"sysobj",
".",
"Call",
"(",
"dbusInterface",
"+",
"\"",
"\"",
",",
"0",
... | // Call some remote method to see whether the service is actually running. | [
"Call",
"some",
"remote",
"method",
"to",
"see",
"whether",
"the",
"service",
"is",
"actually",
"running",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/iptables/firewalld.go#L148-L157 |
22,367 | docker/libnetwork | drivers/windows/overlay/ov_network_windows.go | contains | func (n *network) contains(ip net.IP) bool {
for _, s := range n.subnets {
if s.subnetIP.Contains(ip) {
return true
}
}
return false
} | go | func (n *network) contains(ip net.IP) bool {
for _, s := range n.subnets {
if s.subnetIP.Contains(ip) {
return true
}
}
return false
} | [
"func",
"(",
"n",
"*",
"network",
")",
"contains",
"(",
"ip",
"net",
".",
"IP",
")",
"bool",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"n",
".",
"subnets",
"{",
"if",
"s",
".",
"subnetIP",
".",
"Contains",
"(",
"ip",
")",
"{",
"return",
"true",... | // contains return true if the passed ip belongs to one the network's
// subnets | [
"contains",
"return",
"true",
"if",
"the",
"passed",
"ip",
"belongs",
"to",
"one",
"the",
"network",
"s",
"subnets"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/overlay/ov_network_windows.go#L341-L349 |
22,368 | docker/libnetwork | drivers/windows/overlay/ov_network_windows.go | getMatchingSubnet | func (n *network) getMatchingSubnet(ip *net.IPNet) *subnet {
if ip == nil {
return nil
}
for _, s := range n.subnets {
// first check if the mask lengths are the same
i, _ := s.subnetIP.Mask.Size()
j, _ := ip.Mask.Size()
if i != j {
continue
}
if s.subnetIP.IP.Equal(ip.IP) {
return s
}
}
retu... | go | func (n *network) getMatchingSubnet(ip *net.IPNet) *subnet {
if ip == nil {
return nil
}
for _, s := range n.subnets {
// first check if the mask lengths are the same
i, _ := s.subnetIP.Mask.Size()
j, _ := ip.Mask.Size()
if i != j {
continue
}
if s.subnetIP.IP.Equal(ip.IP) {
return s
}
}
retu... | [
"func",
"(",
"n",
"*",
"network",
")",
"getMatchingSubnet",
"(",
"ip",
"*",
"net",
".",
"IPNet",
")",
"*",
"subnet",
"{",
"if",
"ip",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"n",
".",
"subnets",
... | // getMatchingSubnet return the network's subnet that matches the input | [
"getMatchingSubnet",
"return",
"the",
"network",
"s",
"subnet",
"that",
"matches",
"the",
"input"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/windows/overlay/ov_network_windows.go#L368-L384 |
22,369 | docker/libnetwork | ipam/structures.go | String | func (r *AddressRange) String() string {
return fmt.Sprintf("Sub: %s, range [%d, %d]", r.Sub, r.Start, r.End)
} | go | func (r *AddressRange) String() string {
return fmt.Sprintf("Sub: %s, range [%d, %d]", r.Sub, r.Start, r.End)
} | [
"func",
"(",
"r",
"*",
"AddressRange",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Sub",
",",
"r",
".",
"Start",
",",
"r",
".",
"End",
")",
"\n",
"}"
] | // String returns the string form of the AddressRange object | [
"String",
"returns",
"the",
"string",
"form",
"of",
"the",
"AddressRange",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L50-L52 |
22,370 | docker/libnetwork | ipam/structures.go | MarshalJSON | func (r *AddressRange) MarshalJSON() ([]byte, error) {
m := map[string]interface{}{
"Sub": r.Sub.String(),
"Start": r.Start,
"End": r.End,
}
return json.Marshal(m)
} | go | func (r *AddressRange) MarshalJSON() ([]byte, error) {
m := map[string]interface{}{
"Sub": r.Sub.String(),
"Start": r.Start,
"End": r.End,
}
return json.Marshal(m)
} | [
"func",
"(",
"r",
"*",
"AddressRange",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"m",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"r",
".",
"Sub",
".",
"String",
"(",
")",
"... | // MarshalJSON returns the JSON encoding of the Range object | [
"MarshalJSON",
"returns",
"the",
"JSON",
"encoding",
"of",
"the",
"Range",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L55-L62 |
22,371 | docker/libnetwork | ipam/structures.go | UnmarshalJSON | func (r *AddressRange) UnmarshalJSON(data []byte) error {
m := map[string]interface{}{}
err := json.Unmarshal(data, &m)
if err != nil {
return err
}
if r.Sub, err = types.ParseCIDR(m["Sub"].(string)); err != nil {
return err
}
r.Start = uint64(m["Start"].(float64))
r.End = uint64(m["End"].(float64))
return... | go | func (r *AddressRange) UnmarshalJSON(data []byte) error {
m := map[string]interface{}{}
err := json.Unmarshal(data, &m)
if err != nil {
return err
}
if r.Sub, err = types.ParseCIDR(m["Sub"].(string)); err != nil {
return err
}
r.Start = uint64(m["Start"].(float64))
r.End = uint64(m["End"].(float64))
return... | [
"func",
"(",
"r",
"*",
"AddressRange",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"m",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"... | // UnmarshalJSON decodes data into the Range object | [
"UnmarshalJSON",
"decodes",
"data",
"into",
"the",
"Range",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L65-L77 |
22,372 | docker/libnetwork | ipam/structures.go | String | func (s *SubnetKey) String() string {
k := fmt.Sprintf("%s/%s", s.AddressSpace, s.Subnet)
if s.ChildSubnet != "" {
k = fmt.Sprintf("%s/%s", k, s.ChildSubnet)
}
return k
} | go | func (s *SubnetKey) String() string {
k := fmt.Sprintf("%s/%s", s.AddressSpace, s.Subnet)
if s.ChildSubnet != "" {
k = fmt.Sprintf("%s/%s", k, s.ChildSubnet)
}
return k
} | [
"func",
"(",
"s",
"*",
"SubnetKey",
")",
"String",
"(",
")",
"string",
"{",
"k",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"AddressSpace",
",",
"s",
".",
"Subnet",
")",
"\n",
"if",
"s",
".",
"ChildSubnet",
"!=",
"\"",
"\"",
"... | // String returns the string form of the SubnetKey object | [
"String",
"returns",
"the",
"string",
"form",
"of",
"the",
"SubnetKey",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L80-L86 |
22,373 | docker/libnetwork | ipam/structures.go | FromString | func (s *SubnetKey) FromString(str string) error {
if str == "" || !strings.Contains(str, "/") {
return types.BadRequestErrorf("invalid string form for subnetkey: %s", str)
}
p := strings.Split(str, "/")
if len(p) != 3 && len(p) != 5 {
return types.BadRequestErrorf("invalid string form for subnetkey: %s", str)... | go | func (s *SubnetKey) FromString(str string) error {
if str == "" || !strings.Contains(str, "/") {
return types.BadRequestErrorf("invalid string form for subnetkey: %s", str)
}
p := strings.Split(str, "/")
if len(p) != 3 && len(p) != 5 {
return types.BadRequestErrorf("invalid string form for subnetkey: %s", str)... | [
"func",
"(",
"s",
"*",
"SubnetKey",
")",
"FromString",
"(",
"str",
"string",
")",
"error",
"{",
"if",
"str",
"==",
"\"",
"\"",
"||",
"!",
"strings",
".",
"Contains",
"(",
"str",
",",
"\"",
"\"",
")",
"{",
"return",
"types",
".",
"BadRequestErrorf",
... | // FromString populates the SubnetKey object reading it from string | [
"FromString",
"populates",
"the",
"SubnetKey",
"object",
"reading",
"it",
"from",
"string"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L89-L105 |
22,374 | docker/libnetwork | ipam/structures.go | String | func (p *PoolData) String() string {
return fmt.Sprintf("ParentKey: %s, Pool: %s, Range: %s, RefCount: %d",
p.ParentKey.String(), p.Pool.String(), p.Range, p.RefCount)
} | go | func (p *PoolData) String() string {
return fmt.Sprintf("ParentKey: %s, Pool: %s, Range: %s, RefCount: %d",
p.ParentKey.String(), p.Pool.String(), p.Range, p.RefCount)
} | [
"func",
"(",
"p",
"*",
"PoolData",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"ParentKey",
".",
"String",
"(",
")",
",",
"p",
".",
"Pool",
".",
"String",
"(",
")",
",",
"p",
".",
"... | // String returns the string form of the PoolData object | [
"String",
"returns",
"the",
"string",
"form",
"of",
"the",
"PoolData",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L108-L111 |
22,375 | docker/libnetwork | ipam/structures.go | MarshalJSON | func (p *PoolData) MarshalJSON() ([]byte, error) {
m := map[string]interface{}{
"ParentKey": p.ParentKey,
"RefCount": p.RefCount,
}
if p.Pool != nil {
m["Pool"] = p.Pool.String()
}
if p.Range != nil {
m["Range"] = p.Range
}
return json.Marshal(m)
} | go | func (p *PoolData) MarshalJSON() ([]byte, error) {
m := map[string]interface{}{
"ParentKey": p.ParentKey,
"RefCount": p.RefCount,
}
if p.Pool != nil {
m["Pool"] = p.Pool.String()
}
if p.Range != nil {
m["Range"] = p.Range
}
return json.Marshal(m)
} | [
"func",
"(",
"p",
"*",
"PoolData",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"m",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ParentKey",
",",
"\"",
"\"",
":",
"p... | // MarshalJSON returns the JSON encoding of the PoolData object | [
"MarshalJSON",
"returns",
"the",
"JSON",
"encoding",
"of",
"the",
"PoolData",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L114-L126 |
22,376 | docker/libnetwork | ipam/structures.go | UnmarshalJSON | func (p *PoolData) UnmarshalJSON(data []byte) error {
var (
err error
t struct {
ParentKey SubnetKey
Pool string
Range *AddressRange `json:",omitempty"`
RefCount int
}
)
if err = json.Unmarshal(data, &t); err != nil {
return err
}
p.ParentKey = t.ParentKey
p.Range = t.Range
p.Re... | go | func (p *PoolData) UnmarshalJSON(data []byte) error {
var (
err error
t struct {
ParentKey SubnetKey
Pool string
Range *AddressRange `json:",omitempty"`
RefCount int
}
)
if err = json.Unmarshal(data, &t); err != nil {
return err
}
p.ParentKey = t.ParentKey
p.Range = t.Range
p.Re... | [
"func",
"(",
"p",
"*",
"PoolData",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"(",
"err",
"error",
"\n",
"t",
"struct",
"{",
"ParentKey",
"SubnetKey",
"\n",
"Pool",
"string",
"\n",
"Range",
"*",
"AddressRange",
"`jso... | // UnmarshalJSON decodes data into the PoolData object | [
"UnmarshalJSON",
"decodes",
"data",
"into",
"the",
"PoolData",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L129-L154 |
22,377 | docker/libnetwork | ipam/structures.go | MarshalJSON | func (aSpace *addrSpace) MarshalJSON() ([]byte, error) {
aSpace.Lock()
defer aSpace.Unlock()
m := map[string]interface{}{
"Scope": string(aSpace.scope),
}
if aSpace.subnets != nil {
s := map[string]*PoolData{}
for k, v := range aSpace.subnets {
s[k.String()] = v
}
m["Subnets"] = s
}
return json.M... | go | func (aSpace *addrSpace) MarshalJSON() ([]byte, error) {
aSpace.Lock()
defer aSpace.Unlock()
m := map[string]interface{}{
"Scope": string(aSpace.scope),
}
if aSpace.subnets != nil {
s := map[string]*PoolData{}
for k, v := range aSpace.subnets {
s[k.String()] = v
}
m["Subnets"] = s
}
return json.M... | [
"func",
"(",
"aSpace",
"*",
"addrSpace",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"aSpace",
".",
"Lock",
"(",
")",
"\n",
"defer",
"aSpace",
".",
"Unlock",
"(",
")",
"\n\n",
"m",
":=",
"map",
"[",
"string",
"]",... | // MarshalJSON returns the JSON encoding of the addrSpace object | [
"MarshalJSON",
"returns",
"the",
"JSON",
"encoding",
"of",
"the",
"addrSpace",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L157-L174 |
22,378 | docker/libnetwork | ipam/structures.go | UnmarshalJSON | func (aSpace *addrSpace) UnmarshalJSON(data []byte) error {
aSpace.Lock()
defer aSpace.Unlock()
m := map[string]interface{}{}
err := json.Unmarshal(data, &m)
if err != nil {
return err
}
aSpace.scope = datastore.LocalScope
s := m["Scope"].(string)
if s == string(datastore.GlobalScope) {
aSpace.scope = da... | go | func (aSpace *addrSpace) UnmarshalJSON(data []byte) error {
aSpace.Lock()
defer aSpace.Unlock()
m := map[string]interface{}{}
err := json.Unmarshal(data, &m)
if err != nil {
return err
}
aSpace.scope = datastore.LocalScope
s := m["Scope"].(string)
if s == string(datastore.GlobalScope) {
aSpace.scope = da... | [
"func",
"(",
"aSpace",
"*",
"addrSpace",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"aSpace",
".",
"Lock",
"(",
")",
"\n",
"defer",
"aSpace",
".",
"Unlock",
"(",
")",
"\n\n",
"m",
":=",
"map",
"[",
"string",
"]",
"inter... | // UnmarshalJSON decodes data into the addrSpace object | [
"UnmarshalJSON",
"decodes",
"data",
"into",
"the",
"addrSpace",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L177-L208 |
22,379 | docker/libnetwork | ipam/structures.go | CopyTo | func (p *PoolData) CopyTo(dstP *PoolData) error {
dstP.ParentKey = p.ParentKey
dstP.Pool = types.GetIPNetCopy(p.Pool)
if p.Range != nil {
dstP.Range = &AddressRange{}
dstP.Range.Sub = types.GetIPNetCopy(p.Range.Sub)
dstP.Range.Start = p.Range.Start
dstP.Range.End = p.Range.End
}
dstP.RefCount = p.RefCoun... | go | func (p *PoolData) CopyTo(dstP *PoolData) error {
dstP.ParentKey = p.ParentKey
dstP.Pool = types.GetIPNetCopy(p.Pool)
if p.Range != nil {
dstP.Range = &AddressRange{}
dstP.Range.Sub = types.GetIPNetCopy(p.Range.Sub)
dstP.Range.Start = p.Range.Start
dstP.Range.End = p.Range.End
}
dstP.RefCount = p.RefCoun... | [
"func",
"(",
"p",
"*",
"PoolData",
")",
"CopyTo",
"(",
"dstP",
"*",
"PoolData",
")",
"error",
"{",
"dstP",
".",
"ParentKey",
"=",
"p",
".",
"ParentKey",
"\n",
"dstP",
".",
"Pool",
"=",
"types",
".",
"GetIPNetCopy",
"(",
"p",
".",
"Pool",
")",
"\n\n... | // CopyTo deep copies the pool data to the destination pooldata | [
"CopyTo",
"deep",
"copies",
"the",
"pool",
"data",
"to",
"the",
"destination",
"pooldata"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L211-L224 |
22,380 | docker/libnetwork | ipam/structures.go | updatePoolDBOnAdd | func (aSpace *addrSpace) updatePoolDBOnAdd(k SubnetKey, nw *net.IPNet, ipr *AddressRange, pdf bool) (func() error, error) {
aSpace.Lock()
defer aSpace.Unlock()
// Check if already allocated
if _, ok := aSpace.subnets[k]; ok {
if pdf {
return nil, types.InternalMaskableErrorf("predefined pool %s is already res... | go | func (aSpace *addrSpace) updatePoolDBOnAdd(k SubnetKey, nw *net.IPNet, ipr *AddressRange, pdf bool) (func() error, error) {
aSpace.Lock()
defer aSpace.Unlock()
// Check if already allocated
if _, ok := aSpace.subnets[k]; ok {
if pdf {
return nil, types.InternalMaskableErrorf("predefined pool %s is already res... | [
"func",
"(",
"aSpace",
"*",
"addrSpace",
")",
"updatePoolDBOnAdd",
"(",
"k",
"SubnetKey",
",",
"nw",
"*",
"net",
".",
"IPNet",
",",
"ipr",
"*",
"AddressRange",
",",
"pdf",
"bool",
")",
"(",
"func",
"(",
")",
"error",
",",
"error",
")",
"{",
"aSpace",... | // updatePoolDBOnAdd returns a closure which will add the subnet k to the address space when executed. | [
"updatePoolDBOnAdd",
"returns",
"a",
"closure",
"which",
"will",
"add",
"the",
"subnet",
"k",
"to",
"the",
"address",
"space",
"when",
"executed",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L261-L304 |
22,381 | docker/libnetwork | ipam/structures.go | contains | func (aSpace *addrSpace) contains(space string, nw *net.IPNet) bool {
for k, v := range aSpace.subnets {
if space == k.AddressSpace && k.ChildSubnet == "" {
if nw.Contains(v.Pool.IP) || v.Pool.Contains(nw.IP) {
return true
}
}
}
return false
} | go | func (aSpace *addrSpace) contains(space string, nw *net.IPNet) bool {
for k, v := range aSpace.subnets {
if space == k.AddressSpace && k.ChildSubnet == "" {
if nw.Contains(v.Pool.IP) || v.Pool.Contains(nw.IP) {
return true
}
}
}
return false
} | [
"func",
"(",
"aSpace",
"*",
"addrSpace",
")",
"contains",
"(",
"space",
"string",
",",
"nw",
"*",
"net",
".",
"IPNet",
")",
"bool",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"aSpace",
".",
"subnets",
"{",
"if",
"space",
"==",
"k",
".",
"AddressSpac... | // Checks whether the passed subnet is a superset or subset of any of the subset in this config db | [
"Checks",
"whether",
"the",
"passed",
"subnet",
"is",
"a",
"superset",
"or",
"subset",
"of",
"any",
"of",
"the",
"subset",
"in",
"this",
"config",
"db"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipam/structures.go#L348-L357 |
22,382 | docker/libnetwork | cmd/proxy/stub_proxy.go | NewStubProxy | func NewStubProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) {
return &StubProxy{
frontendAddr: frontendAddr,
backendAddr: backendAddr,
}, nil
} | go | func NewStubProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) {
return &StubProxy{
frontendAddr: frontendAddr,
backendAddr: backendAddr,
}, nil
} | [
"func",
"NewStubProxy",
"(",
"frontendAddr",
",",
"backendAddr",
"net",
".",
"Addr",
")",
"(",
"Proxy",
",",
"error",
")",
"{",
"return",
"&",
"StubProxy",
"{",
"frontendAddr",
":",
"frontendAddr",
",",
"backendAddr",
":",
"backendAddr",
",",
"}",
",",
"ni... | // NewStubProxy creates a new StubProxy | [
"NewStubProxy",
"creates",
"a",
"new",
"StubProxy"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/cmd/proxy/stub_proxy.go#L26-L31 |
22,383 | docker/libnetwork | netutils/utils_linux.go | CheckRouteOverlaps | func CheckRouteOverlaps(toCheck *net.IPNet) error {
if networkGetRoutesFct == nil {
networkGetRoutesFct = ns.NlHandle().RouteList
}
networks, err := networkGetRoutesFct(nil, netlink.FAMILY_V4)
if err != nil {
return err
}
for _, network := range networks {
if network.Dst != nil && NetworkOverlaps(toCheck, n... | go | func CheckRouteOverlaps(toCheck *net.IPNet) error {
if networkGetRoutesFct == nil {
networkGetRoutesFct = ns.NlHandle().RouteList
}
networks, err := networkGetRoutesFct(nil, netlink.FAMILY_V4)
if err != nil {
return err
}
for _, network := range networks {
if network.Dst != nil && NetworkOverlaps(toCheck, n... | [
"func",
"CheckRouteOverlaps",
"(",
"toCheck",
"*",
"net",
".",
"IPNet",
")",
"error",
"{",
"if",
"networkGetRoutesFct",
"==",
"nil",
"{",
"networkGetRoutesFct",
"=",
"ns",
".",
"NlHandle",
"(",
")",
".",
"RouteList",
"\n",
"}",
"\n",
"networks",
",",
"err"... | // CheckRouteOverlaps checks whether the passed network overlaps with any existing routes | [
"CheckRouteOverlaps",
"checks",
"whether",
"the",
"passed",
"network",
"overlaps",
"with",
"any",
"existing",
"routes"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils_linux.go#L25-L39 |
22,384 | docker/libnetwork | netutils/utils_linux.go | GenerateIfaceName | func GenerateIfaceName(nlh *netlink.Handle, prefix string, len int) (string, error) {
linkByName := netlink.LinkByName
if nlh != nil {
linkByName = nlh.LinkByName
}
for i := 0; i < 3; i++ {
name, err := GenerateRandomName(prefix, len)
if err != nil {
continue
}
_, err = linkByName(name)
if err != nil... | go | func GenerateIfaceName(nlh *netlink.Handle, prefix string, len int) (string, error) {
linkByName := netlink.LinkByName
if nlh != nil {
linkByName = nlh.LinkByName
}
for i := 0; i < 3; i++ {
name, err := GenerateRandomName(prefix, len)
if err != nil {
continue
}
_, err = linkByName(name)
if err != nil... | [
"func",
"GenerateIfaceName",
"(",
"nlh",
"*",
"netlink",
".",
"Handle",
",",
"prefix",
"string",
",",
"len",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"linkByName",
":=",
"netlink",
".",
"LinkByName",
"\n",
"if",
"nlh",
"!=",
"nil",
"{",
"link... | // GenerateIfaceName returns an interface name using the passed in
// prefix and the length of random bytes. The api ensures that the
// there are is no interface which exists with that name. | [
"GenerateIfaceName",
"returns",
"an",
"interface",
"name",
"using",
"the",
"passed",
"in",
"prefix",
"and",
"the",
"length",
"of",
"random",
"bytes",
".",
"The",
"api",
"ensures",
"that",
"the",
"there",
"are",
"is",
"no",
"interface",
"which",
"exists",
"wi... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils_linux.go#L44-L63 |
22,385 | docker/libnetwork | osl/namespace_linux.go | GC | func GC() {
gpmLock.Lock()
if len(garbagePathMap) == 0 {
// No need for GC if map is empty
gpmLock.Unlock()
return
}
gpmLock.Unlock()
// if content exists in the garbage paths
// we can trigger GC to run, providing a
// channel to be notified on completion
waitGC := make(chan struct{})
gpmChan <- waitGC... | go | func GC() {
gpmLock.Lock()
if len(garbagePathMap) == 0 {
// No need for GC if map is empty
gpmLock.Unlock()
return
}
gpmLock.Unlock()
// if content exists in the garbage paths
// we can trigger GC to run, providing a
// channel to be notified on completion
waitGC := make(chan struct{})
gpmChan <- waitGC... | [
"func",
"GC",
"(",
")",
"{",
"gpmLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"len",
"(",
"garbagePathMap",
")",
"==",
"0",
"{",
"// No need for GC if map is empty",
"gpmLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"gpmLock",
".",
"Unl... | // GC triggers garbage collection of namespace path right away
// and waits for it. | [
"GC",
"triggers",
"garbage",
"collection",
"of",
"namespace",
"path",
"right",
"away",
"and",
"waits",
"for",
"it",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/osl/namespace_linux.go#L138-L154 |
22,386 | docker/libnetwork | osl/namespace_linux.go | GetSandboxForExternalKey | func GetSandboxForExternalKey(basePath string, key string) (Sandbox, error) {
if err := createNamespaceFile(key); err != nil {
return nil, err
}
if err := mountNetworkNamespace(basePath, key); err != nil {
return nil, err
}
n := &networkNamespace{path: key, nextIfIndex: make(map[string]int)}
sboxNs, err := ... | go | func GetSandboxForExternalKey(basePath string, key string) (Sandbox, error) {
if err := createNamespaceFile(key); err != nil {
return nil, err
}
if err := mountNetworkNamespace(basePath, key); err != nil {
return nil, err
}
n := &networkNamespace{path: key, nextIfIndex: make(map[string]int)}
sboxNs, err := ... | [
"func",
"GetSandboxForExternalKey",
"(",
"basePath",
"string",
",",
"key",
"string",
")",
"(",
"Sandbox",
",",
"error",
")",
"{",
"if",
"err",
":=",
"createNamespaceFile",
"(",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
... | // GetSandboxForExternalKey returns sandbox object for the supplied path | [
"GetSandboxForExternalKey",
"returns",
"sandbox",
"object",
"for",
"the",
"supplied",
"path"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/osl/namespace_linux.go#L261-L299 |
22,387 | docker/libnetwork | osl/namespace_linux.go | InitOSContext | func InitOSContext() func() {
runtime.LockOSThread()
if err := ns.SetNamespace(); err != nil {
logrus.Error(err)
}
return runtime.UnlockOSThread
} | go | func InitOSContext() func() {
runtime.LockOSThread()
if err := ns.SetNamespace(); err != nil {
logrus.Error(err)
}
return runtime.UnlockOSThread
} | [
"func",
"InitOSContext",
"(",
")",
"func",
"(",
")",
"{",
"runtime",
".",
"LockOSThread",
"(",
")",
"\n",
"if",
"err",
":=",
"ns",
".",
"SetNamespace",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Error",
"(",
"err",
")",
"\n",
"}",
"\... | // InitOSContext initializes OS context while configuring network resources | [
"InitOSContext",
"initializes",
"OS",
"context",
"while",
"configuring",
"network",
"resources"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/osl/namespace_linux.go#L425-L431 |
22,388 | docker/libnetwork | osl/namespace_linux.go | ApplyOSTweaks | func (n *networkNamespace) ApplyOSTweaks(types []SandboxType) {
for _, t := range types {
switch t {
case SandboxTypeLoadBalancer:
kernel.ApplyOSTweaks(loadBalancerConfig)
}
}
} | go | func (n *networkNamespace) ApplyOSTweaks(types []SandboxType) {
for _, t := range types {
switch t {
case SandboxTypeLoadBalancer:
kernel.ApplyOSTweaks(loadBalancerConfig)
}
}
} | [
"func",
"(",
"n",
"*",
"networkNamespace",
")",
"ApplyOSTweaks",
"(",
"types",
"[",
"]",
"SandboxType",
")",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"types",
"{",
"switch",
"t",
"{",
"case",
"SandboxTypeLoadBalancer",
":",
"kernel",
".",
"ApplyOSTweaks",... | // ApplyOSTweaks applies linux configs on the sandbox | [
"ApplyOSTweaks",
"applies",
"linux",
"configs",
"on",
"the",
"sandbox"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/osl/namespace_linux.go#L680-L687 |
22,389 | docker/libnetwork | networkdb/watch.go | Watch | func (nDB *NetworkDB) Watch(tname, nid, key string) (*events.Channel, func()) {
var matcher events.Matcher
if tname != "" || nid != "" || key != "" {
matcher = events.MatcherFunc(func(ev events.Event) bool {
var evt event
switch ev := ev.(type) {
case CreateEvent:
evt = event(ev)
case UpdateEvent:
... | go | func (nDB *NetworkDB) Watch(tname, nid, key string) (*events.Channel, func()) {
var matcher events.Matcher
if tname != "" || nid != "" || key != "" {
matcher = events.MatcherFunc(func(ev events.Event) bool {
var evt event
switch ev := ev.(type) {
case CreateEvent:
evt = event(ev)
case UpdateEvent:
... | [
"func",
"(",
"nDB",
"*",
"NetworkDB",
")",
"Watch",
"(",
"tname",
",",
"nid",
",",
"key",
"string",
")",
"(",
"*",
"events",
".",
"Channel",
",",
"func",
"(",
")",
")",
"{",
"var",
"matcher",
"events",
".",
"Matcher",
"\n\n",
"if",
"tname",
"!=",
... | // Watch creates a watcher with filters for a particular table or
// network or key or any combination of the tuple. If any of the
// filter is an empty string it acts as a wildcard for that
// field. Watch returns a channel of events, where the events will be
// sent. | [
"Watch",
"creates",
"a",
"watcher",
"with",
"filters",
"for",
"a",
"particular",
"table",
"or",
"network",
"or",
"key",
"or",
"any",
"combination",
"of",
"the",
"tuple",
".",
"If",
"any",
"of",
"the",
"filter",
"is",
"an",
"empty",
"string",
"it",
"acts"... | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/networkdb/watch.go#L46-L90 |
22,390 | docker/libnetwork | cmd/proxy/tcp_proxy.go | Run | func (proxy *TCPProxy) Run() {
quit := make(chan bool)
defer close(quit)
for {
client, err := proxy.listener.Accept()
if err != nil {
log.Printf("Stopping proxy on tcp/%v for tcp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err)
return
}
go proxy.clientLoop(client.(*net.TCPConn), quit)
}
} | go | func (proxy *TCPProxy) Run() {
quit := make(chan bool)
defer close(quit)
for {
client, err := proxy.listener.Accept()
if err != nil {
log.Printf("Stopping proxy on tcp/%v for tcp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err)
return
}
go proxy.clientLoop(client.(*net.TCPConn), quit)
}
} | [
"func",
"(",
"proxy",
"*",
"TCPProxy",
")",
"Run",
"(",
")",
"{",
"quit",
":=",
"make",
"(",
"chan",
"bool",
")",
"\n",
"defer",
"close",
"(",
"quit",
")",
"\n",
"for",
"{",
"client",
",",
"err",
":=",
"proxy",
".",
"listener",
".",
"Accept",
"("... | // Run starts forwarding the traffic using TCP. | [
"Run",
"starts",
"forwarding",
"the",
"traffic",
"using",
"TCP",
"."
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/cmd/proxy/tcp_proxy.go#L69-L80 |
22,391 | docker/libnetwork | bitseq/store.go | SetValue | func (h *Handle) SetValue(value []byte) error {
return json.Unmarshal(value, h)
} | go | func (h *Handle) SetValue(value []byte) error {
return json.Unmarshal(value, h)
} | [
"func",
"(",
"h",
"*",
"Handle",
")",
"SetValue",
"(",
"value",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"json",
".",
"Unmarshal",
"(",
"value",
",",
"h",
")",
"\n",
"}"
] | // SetValue unmarshals the data from the KV store | [
"SetValue",
"unmarshals",
"the",
"data",
"from",
"the",
"KV",
"store"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/store.go#L35-L37 |
22,392 | docker/libnetwork | bitseq/store.go | New | func (h *Handle) New() datastore.KVObject {
h.Lock()
defer h.Unlock()
return &Handle{
app: h.app,
store: h.store,
}
} | go | func (h *Handle) New() datastore.KVObject {
h.Lock()
defer h.Unlock()
return &Handle{
app: h.app,
store: h.store,
}
} | [
"func",
"(",
"h",
"*",
"Handle",
")",
"New",
"(",
")",
"datastore",
".",
"KVObject",
"{",
"h",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"&",
"Handle",
"{",
"app",
":",
"h",
".",
"app",
",",
"store",
... | // New method returns a handle based on the receiver handle | [
"New",
"method",
"returns",
"a",
"handle",
"based",
"on",
"the",
"receiver",
"handle"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/store.go#L62-L70 |
22,393 | docker/libnetwork | bitseq/store.go | CopyTo | func (h *Handle) CopyTo(o datastore.KVObject) error {
h.Lock()
defer h.Unlock()
dstH := o.(*Handle)
if h == dstH {
return nil
}
dstH.Lock()
dstH.bits = h.bits
dstH.unselected = h.unselected
dstH.head = h.head.getCopy()
dstH.app = h.app
dstH.id = h.id
dstH.dbIndex = h.dbIndex
dstH.dbExists = h.dbExists
... | go | func (h *Handle) CopyTo(o datastore.KVObject) error {
h.Lock()
defer h.Unlock()
dstH := o.(*Handle)
if h == dstH {
return nil
}
dstH.Lock()
dstH.bits = h.bits
dstH.unselected = h.unselected
dstH.head = h.head.getCopy()
dstH.app = h.app
dstH.id = h.id
dstH.dbIndex = h.dbIndex
dstH.dbExists = h.dbExists
... | [
"func",
"(",
"h",
"*",
"Handle",
")",
"CopyTo",
"(",
"o",
"datastore",
".",
"KVObject",
")",
"error",
"{",
"h",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"Unlock",
"(",
")",
"\n\n",
"dstH",
":=",
"o",
".",
"(",
"*",
"Handle",
")",
"\n",
... | // CopyTo deep copies the handle into the passed destination object | [
"CopyTo",
"deep",
"copies",
"the",
"handle",
"into",
"the",
"passed",
"destination",
"object"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/bitseq/store.go#L73-L94 |
22,394 | docker/libnetwork | drivers/ipvlan/ipvlan_setup.go | createIPVlan | func createIPVlan(containerIfName, parent, ipvlanMode string) (string, error) {
// Set the ipvlan mode. Default is bridge mode
mode, err := setIPVlanMode(ipvlanMode)
if err != nil {
return "", fmt.Errorf("Unsupported %s ipvlan mode: %v", ipvlanMode, err)
}
// verify the Docker host interface acting as the macvla... | go | func createIPVlan(containerIfName, parent, ipvlanMode string) (string, error) {
// Set the ipvlan mode. Default is bridge mode
mode, err := setIPVlanMode(ipvlanMode)
if err != nil {
return "", fmt.Errorf("Unsupported %s ipvlan mode: %v", ipvlanMode, err)
}
// verify the Docker host interface acting as the macvla... | [
"func",
"createIPVlan",
"(",
"containerIfName",
",",
"parent",
",",
"ipvlanMode",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Set the ipvlan mode. Default is bridge mode",
"mode",
",",
"err",
":=",
"setIPVlanMode",
"(",
"ipvlanMode",
")",
"\n",
"if",... | // createIPVlan Create the ipvlan slave specifying the source name | [
"createIPVlan",
"Create",
"the",
"ipvlan",
"slave",
"specifying",
"the",
"source",
"name"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_setup.go#L20-L49 |
22,395 | docker/libnetwork | drivers/ipvlan/ipvlan_setup.go | setIPVlanMode | func setIPVlanMode(mode string) (netlink.IPVlanMode, error) {
switch mode {
case modeL2:
return netlink.IPVLAN_MODE_L2, nil
case modeL3:
return netlink.IPVLAN_MODE_L3, nil
default:
return 0, fmt.Errorf("Unknown ipvlan mode: %s", mode)
}
} | go | func setIPVlanMode(mode string) (netlink.IPVlanMode, error) {
switch mode {
case modeL2:
return netlink.IPVLAN_MODE_L2, nil
case modeL3:
return netlink.IPVLAN_MODE_L3, nil
default:
return 0, fmt.Errorf("Unknown ipvlan mode: %s", mode)
}
} | [
"func",
"setIPVlanMode",
"(",
"mode",
"string",
")",
"(",
"netlink",
".",
"IPVlanMode",
",",
"error",
")",
"{",
"switch",
"mode",
"{",
"case",
"modeL2",
":",
"return",
"netlink",
".",
"IPVLAN_MODE_L2",
",",
"nil",
"\n",
"case",
"modeL3",
":",
"return",
"... | // setIPVlanMode setter for one of the two ipvlan port types | [
"setIPVlanMode",
"setter",
"for",
"one",
"of",
"the",
"two",
"ipvlan",
"port",
"types"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_setup.go#L52-L61 |
22,396 | docker/libnetwork | drivers/ipvlan/ipvlan_setup.go | parentExists | func parentExists(ifaceStr string) bool {
_, err := ns.NlHandle().LinkByName(ifaceStr)
if err != nil {
return false
}
return true
} | go | func parentExists(ifaceStr string) bool {
_, err := ns.NlHandle().LinkByName(ifaceStr)
if err != nil {
return false
}
return true
} | [
"func",
"parentExists",
"(",
"ifaceStr",
"string",
")",
"bool",
"{",
"_",
",",
"err",
":=",
"ns",
".",
"NlHandle",
"(",
")",
".",
"LinkByName",
"(",
"ifaceStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",... | // parentExists check if the specified interface exists in the default namespace | [
"parentExists",
"check",
"if",
"the",
"specified",
"interface",
"exists",
"in",
"the",
"default",
"namespace"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_setup.go#L64-L71 |
22,397 | docker/libnetwork | drivers/ipvlan/ipvlan_setup.go | createVlanLink | func createVlanLink(parentName string) error {
if strings.Contains(parentName, ".") {
parent, vidInt, err := parseVlan(parentName)
if err != nil {
return err
}
// VLAN identifier or VID is a 12-bit field specifying the VLAN to which the frame belongs
if vidInt > 4094 || vidInt < 1 {
return fmt.Errorf("... | go | func createVlanLink(parentName string) error {
if strings.Contains(parentName, ".") {
parent, vidInt, err := parseVlan(parentName)
if err != nil {
return err
}
// VLAN identifier or VID is a 12-bit field specifying the VLAN to which the frame belongs
if vidInt > 4094 || vidInt < 1 {
return fmt.Errorf("... | [
"func",
"createVlanLink",
"(",
"parentName",
"string",
")",
"error",
"{",
"if",
"strings",
".",
"Contains",
"(",
"parentName",
",",
"\"",
"\"",
")",
"{",
"parent",
",",
"vidInt",
",",
"err",
":=",
"parseVlan",
"(",
"parentName",
")",
"\n",
"if",
"err",
... | // createVlanLink parses sub-interfaces and vlan id for creation | [
"createVlanLink",
"parses",
"sub",
"-",
"interfaces",
"and",
"vlan",
"id",
"for",
"creation"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_setup.go#L74-L109 |
22,398 | docker/libnetwork | drivers/ipvlan/ipvlan_setup.go | createDummyLink | func createDummyLink(dummyName, truncNetID string) error {
// create a parent interface since one was not specified
parent := &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{
Name: dummyName,
},
}
if err := ns.NlHandle().LinkAdd(parent); err != nil {
return err
}
parentDummyLink, err := ns.NlHandle().LinkBy... | go | func createDummyLink(dummyName, truncNetID string) error {
// create a parent interface since one was not specified
parent := &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{
Name: dummyName,
},
}
if err := ns.NlHandle().LinkAdd(parent); err != nil {
return err
}
parentDummyLink, err := ns.NlHandle().LinkBy... | [
"func",
"createDummyLink",
"(",
"dummyName",
",",
"truncNetID",
"string",
")",
"error",
"{",
"// create a parent interface since one was not specified",
"parent",
":=",
"&",
"netlink",
".",
"Dummy",
"{",
"LinkAttrs",
":",
"netlink",
".",
"LinkAttrs",
"{",
"Name",
":... | // createDummyLink creates a dummy0 parent link | [
"createDummyLink",
"creates",
"a",
"dummy0",
"parent",
"link"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_setup.go#L160-L180 |
22,399 | docker/libnetwork | drivers/ipvlan/ipvlan_setup.go | delDummyLink | func delDummyLink(linkName string) error {
// delete the vlan subinterface
dummyLink, err := ns.NlHandle().LinkByName(linkName)
if err != nil {
return fmt.Errorf("failed to find link %s on the Docker host : %v", linkName, err)
}
// verify a parent interface is being deleted
if dummyLink.Attrs().ParentIndex != 0... | go | func delDummyLink(linkName string) error {
// delete the vlan subinterface
dummyLink, err := ns.NlHandle().LinkByName(linkName)
if err != nil {
return fmt.Errorf("failed to find link %s on the Docker host : %v", linkName, err)
}
// verify a parent interface is being deleted
if dummyLink.Attrs().ParentIndex != 0... | [
"func",
"delDummyLink",
"(",
"linkName",
"string",
")",
"error",
"{",
"// delete the vlan subinterface",
"dummyLink",
",",
"err",
":=",
"ns",
".",
"NlHandle",
"(",
")",
".",
"LinkByName",
"(",
"linkName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // delDummyLink deletes the link type dummy used when -o parent is not passed | [
"delDummyLink",
"deletes",
"the",
"link",
"type",
"dummy",
"used",
"when",
"-",
"o",
"parent",
"is",
"not",
"passed"
] | 9ff9b57c344df5cd47443ad9e65702ec85c5aeb0 | https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_setup.go#L183-L200 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.