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,400
docker/libnetwork
datastore/datastore.go
DefaultScopes
func DefaultScopes(dataDir string) map[string]*ScopeCfg { if dataDir != "" { defaultScopes[LocalScope].Client.Address = dataDir + "/network/files/local-kv.db" return defaultScopes } defaultScopes[LocalScope].Client.Address = defaultPrefix + "/local-kv.db" return defaultScopes }
go
func DefaultScopes(dataDir string) map[string]*ScopeCfg { if dataDir != "" { defaultScopes[LocalScope].Client.Address = dataDir + "/network/files/local-kv.db" return defaultScopes } defaultScopes[LocalScope].Client.Address = defaultPrefix + "/local-kv.db" return defaultScopes }
[ "func", "DefaultScopes", "(", "dataDir", "string", ")", "map", "[", "string", "]", "*", "ScopeCfg", "{", "if", "dataDir", "!=", "\"", "\"", "{", "defaultScopes", "[", "LocalScope", "]", ".", "Client", ".", "Address", "=", "dataDir", "+", "\"", "\"", "\...
// DefaultScopes returns a map of default scopes and its config for clients to use.
[ "DefaultScopes", "returns", "a", "map", "of", "default", "scopes", "and", "its", "config", "for", "clients", "to", "use", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L156-L164
22,401
docker/libnetwork
datastore/datastore.go
IsValid
func (cfg *ScopeCfg) IsValid() bool { if cfg == nil || strings.TrimSpace(cfg.Client.Provider) == "" || strings.TrimSpace(cfg.Client.Address) == "" { return false } return true }
go
func (cfg *ScopeCfg) IsValid() bool { if cfg == nil || strings.TrimSpace(cfg.Client.Provider) == "" || strings.TrimSpace(cfg.Client.Address) == "" { return false } return true }
[ "func", "(", "cfg", "*", "ScopeCfg", ")", "IsValid", "(", ")", "bool", "{", "if", "cfg", "==", "nil", "||", "strings", ".", "TrimSpace", "(", "cfg", ".", "Client", ".", "Provider", ")", "==", "\"", "\"", "||", "strings", ".", "TrimSpace", "(", "cfg...
// IsValid checks if the scope config has valid configuration.
[ "IsValid", "checks", "if", "the", "scope", "config", "has", "valid", "configuration", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L167-L175
22,402
docker/libnetwork
datastore/datastore.go
Key
func Key(key ...string) string { keychain := append(rootChain, key...) str := strings.Join(keychain, "/") return str + "/" }
go
func Key(key ...string) string { keychain := append(rootChain, key...) str := strings.Join(keychain, "/") return str + "/" }
[ "func", "Key", "(", "key", "...", "string", ")", "string", "{", "keychain", ":=", "append", "(", "rootChain", ",", "key", "...", ")", "\n", "str", ":=", "strings", ".", "Join", "(", "keychain", ",", "\"", "\"", ")", "\n", "return", "str", "+", "\""...
//Key provides convenient method to create a Key
[ "Key", "provides", "convenient", "method", "to", "create", "a", "Key" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L178-L182
22,403
docker/libnetwork
datastore/datastore.go
ParseKey
func ParseKey(key string) ([]string, error) { chain := strings.Split(strings.Trim(key, "/"), "/") // The key must at least be equal to the rootChain in order to be considered as valid if len(chain) <= len(rootChain) || !reflect.DeepEqual(chain[0:len(rootChain)], rootChain) { return nil, types.BadRequestErrorf("in...
go
func ParseKey(key string) ([]string, error) { chain := strings.Split(strings.Trim(key, "/"), "/") // The key must at least be equal to the rootChain in order to be considered as valid if len(chain) <= len(rootChain) || !reflect.DeepEqual(chain[0:len(rootChain)], rootChain) { return nil, types.BadRequestErrorf("in...
[ "func", "ParseKey", "(", "key", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "chain", ":=", "strings", ".", "Split", "(", "strings", ".", "Trim", "(", "key", ",", "\"", "\"", ")", ",", "\"", "\"", ")", "\n\n", "// The key must at...
//ParseKey provides convenient method to unpack the key to complement the Key function
[ "ParseKey", "provides", "convenient", "method", "to", "unpack", "the", "key", "to", "complement", "the", "Key", "function" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L185-L193
22,404
docker/libnetwork
datastore/datastore.go
newClient
func newClient(scope string, kv string, addr string, config *store.Config, cached bool) (DataStore, error) { if cached && scope != LocalScope { return nil, fmt.Errorf("caching supported only for scope %s", LocalScope) } sequential := false if scope == LocalScope { sequential = true } if config == nil { co...
go
func newClient(scope string, kv string, addr string, config *store.Config, cached bool) (DataStore, error) { if cached && scope != LocalScope { return nil, fmt.Errorf("caching supported only for scope %s", LocalScope) } sequential := false if scope == LocalScope { sequential = true } if config == nil { co...
[ "func", "newClient", "(", "scope", "string", ",", "kv", "string", ",", "addr", "string", ",", "config", "*", "store", ".", "Config", ",", "cached", "bool", ")", "(", "DataStore", ",", "error", ")", "{", "if", "cached", "&&", "scope", "!=", "LocalScope"...
// newClient used to connect to KV Store
[ "newClient", "used", "to", "connect", "to", "KV", "Store" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L196-L237
22,405
docker/libnetwork
datastore/datastore.go
NewDataStore
func NewDataStore(scope string, cfg *ScopeCfg) (DataStore, error) { if cfg == nil || cfg.Client.Provider == "" || cfg.Client.Address == "" { c, ok := defaultScopes[scope] if !ok || c.Client.Provider == "" || c.Client.Address == "" { return nil, fmt.Errorf("unexpected scope %s without configuration passed", scop...
go
func NewDataStore(scope string, cfg *ScopeCfg) (DataStore, error) { if cfg == nil || cfg.Client.Provider == "" || cfg.Client.Address == "" { c, ok := defaultScopes[scope] if !ok || c.Client.Provider == "" || c.Client.Address == "" { return nil, fmt.Errorf("unexpected scope %s without configuration passed", scop...
[ "func", "NewDataStore", "(", "scope", "string", ",", "cfg", "*", "ScopeCfg", ")", "(", "DataStore", ",", "error", ")", "{", "if", "cfg", "==", "nil", "||", "cfg", ".", "Client", ".", "Provider", "==", "\"", "\"", "||", "cfg", ".", "Client", ".", "A...
// NewDataStore creates a new instance of LibKV data store
[ "NewDataStore", "creates", "a", "new", "instance", "of", "LibKV", "data", "store" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L240-L256
22,406
docker/libnetwork
datastore/datastore.go
NewDataStoreFromConfig
func NewDataStoreFromConfig(dsc discoverapi.DatastoreConfigData) (DataStore, error) { var ( ok bool sCfgP *store.Config ) sCfgP, ok = dsc.Config.(*store.Config) if !ok && dsc.Config != nil { return nil, fmt.Errorf("cannot parse store configuration: %v", dsc.Config) } scopeCfg := &ScopeCfg{ Client: Sc...
go
func NewDataStoreFromConfig(dsc discoverapi.DatastoreConfigData) (DataStore, error) { var ( ok bool sCfgP *store.Config ) sCfgP, ok = dsc.Config.(*store.Config) if !ok && dsc.Config != nil { return nil, fmt.Errorf("cannot parse store configuration: %v", dsc.Config) } scopeCfg := &ScopeCfg{ Client: Sc...
[ "func", "NewDataStoreFromConfig", "(", "dsc", "discoverapi", ".", "DatastoreConfigData", ")", "(", "DataStore", ",", "error", ")", "{", "var", "(", "ok", "bool", "\n", "sCfgP", "*", "store", ".", "Config", "\n", ")", "\n\n", "sCfgP", ",", "ok", "=", "dsc...
// NewDataStoreFromConfig creates a new instance of LibKV data store starting from the datastore config data
[ "NewDataStoreFromConfig", "creates", "a", "new", "instance", "of", "LibKV", "data", "store", "starting", "from", "the", "datastore", "config", "data" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L259-L284
22,407
docker/libnetwork
datastore/datastore.go
PutObjectAtomic
func (ds *datastore) PutObjectAtomic(kvObject KVObject) error { var ( previous *store.KVPair pair *store.KVPair err error ) if ds.sequential { ds.Lock() defer ds.Unlock() } if kvObject == nil { return types.BadRequestErrorf("invalid KV Object : nil") } kvObjValue := kvObject.Value() if k...
go
func (ds *datastore) PutObjectAtomic(kvObject KVObject) error { var ( previous *store.KVPair pair *store.KVPair err error ) if ds.sequential { ds.Lock() defer ds.Unlock() } if kvObject == nil { return types.BadRequestErrorf("invalid KV Object : nil") } kvObjValue := kvObject.Value() if k...
[ "func", "(", "ds", "*", "datastore", ")", "PutObjectAtomic", "(", "kvObject", "KVObject", ")", "error", "{", "var", "(", "previous", "*", "store", ".", "KVPair", "\n", "pair", "*", "store", ".", "KVPair", "\n", "err", "error", "\n", ")", "\n", "if", ...
// PutObjectAtomic adds a new Record based on an object into the datastore
[ "PutObjectAtomic", "adds", "a", "new", "Record", "based", "on", "an", "object", "into", "the", "datastore" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L384-L433
22,408
docker/libnetwork
datastore/datastore.go
PutObject
func (ds *datastore) PutObject(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } if kvObject == nil { return types.BadRequestErrorf("invalid KV Object : nil") } if kvObject.Skip() { goto add_cache } if err := ds.putObjectWithKey(kvObject, kvObject.Key()...); err != nil { re...
go
func (ds *datastore) PutObject(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } if kvObject == nil { return types.BadRequestErrorf("invalid KV Object : nil") } if kvObject.Skip() { goto add_cache } if err := ds.putObjectWithKey(kvObject, kvObject.Key()...); err != nil { re...
[ "func", "(", "ds", "*", "datastore", ")", "PutObject", "(", "kvObject", "KVObject", ")", "error", "{", "if", "ds", ".", "sequential", "{", "ds", ".", "Lock", "(", ")", "\n", "defer", "ds", ".", "Unlock", "(", ")", "\n", "}", "\n\n", "if", "kvObject...
// PutObject adds a new Record based on an object into the datastore
[ "PutObject", "adds", "a", "new", "Record", "based", "on", "an", "object", "into", "the", "datastore" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L436-L462
22,409
docker/libnetwork
datastore/datastore.go
GetObject
func (ds *datastore) GetObject(key string, o KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } if ds.cache != nil { return ds.cache.get(key, o) } kvPair, err := ds.store.Get(key) if err != nil { return err } if err := o.SetValue(kvPair.Value); err != nil { return err } // Make s...
go
func (ds *datastore) GetObject(key string, o KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } if ds.cache != nil { return ds.cache.get(key, o) } kvPair, err := ds.store.Get(key) if err != nil { return err } if err := o.SetValue(kvPair.Value); err != nil { return err } // Make s...
[ "func", "(", "ds", "*", "datastore", ")", "GetObject", "(", "key", "string", ",", "o", "KVObject", ")", "error", "{", "if", "ds", ".", "sequential", "{", "ds", ".", "Lock", "(", ")", "\n", "defer", "ds", ".", "Unlock", "(", ")", "\n", "}", "\n\n"...
// GetObject returns a record matching the key
[ "GetObject", "returns", "a", "record", "matching", "the", "key" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L474-L497
22,410
docker/libnetwork
datastore/datastore.go
DeleteObject
func (ds *datastore) DeleteObject(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } // cleanup the cache first if ds.cache != nil { // If persistent store is skipped, sequencing needs to // happen in cache. ds.cache.del(kvObject, kvObject.Skip()) } if kvObject.Skip() { retu...
go
func (ds *datastore) DeleteObject(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } // cleanup the cache first if ds.cache != nil { // If persistent store is skipped, sequencing needs to // happen in cache. ds.cache.del(kvObject, kvObject.Skip()) } if kvObject.Skip() { retu...
[ "func", "(", "ds", "*", "datastore", ")", "DeleteObject", "(", "kvObject", "KVObject", ")", "error", "{", "if", "ds", ".", "sequential", "{", "ds", ".", "Lock", "(", ")", "\n", "defer", "ds", ".", "Unlock", "(", ")", "\n", "}", "\n\n", "// cleanup th...
// DeleteObject unconditionally deletes a record from the store
[ "DeleteObject", "unconditionally", "deletes", "a", "record", "from", "the", "store" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L586-L604
22,411
docker/libnetwork
datastore/datastore.go
DeleteObjectAtomic
func (ds *datastore) DeleteObjectAtomic(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } if kvObject == nil { return types.BadRequestErrorf("invalid KV Object : nil") } previous := &store.KVPair{Key: Key(kvObject.Key()...), LastIndex: kvObject.Index()} if kvObject.Skip() { go...
go
func (ds *datastore) DeleteObjectAtomic(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } if kvObject == nil { return types.BadRequestErrorf("invalid KV Object : nil") } previous := &store.KVPair{Key: Key(kvObject.Key()...), LastIndex: kvObject.Index()} if kvObject.Skip() { go...
[ "func", "(", "ds", "*", "datastore", ")", "DeleteObjectAtomic", "(", "kvObject", "KVObject", ")", "error", "{", "if", "ds", ".", "sequential", "{", "ds", ".", "Lock", "(", ")", "\n", "defer", "ds", ".", "Unlock", "(", ")", "\n", "}", "\n\n", "if", ...
// DeleteObjectAtomic performs atomic delete on a record
[ "DeleteObjectAtomic", "performs", "atomic", "delete", "on", "a", "record" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L607-L639
22,412
docker/libnetwork
datastore/datastore.go
DeleteTree
func (ds *datastore) DeleteTree(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } // cleanup the cache first if ds.cache != nil { // If persistent store is skipped, sequencing needs to // happen in cache. ds.cache.del(kvObject, kvObject.Skip()) } if kvObject.Skip() { return...
go
func (ds *datastore) DeleteTree(kvObject KVObject) error { if ds.sequential { ds.Lock() defer ds.Unlock() } // cleanup the cache first if ds.cache != nil { // If persistent store is skipped, sequencing needs to // happen in cache. ds.cache.del(kvObject, kvObject.Skip()) } if kvObject.Skip() { return...
[ "func", "(", "ds", "*", "datastore", ")", "DeleteTree", "(", "kvObject", "KVObject", ")", "error", "{", "if", "ds", ".", "sequential", "{", "ds", ".", "Lock", "(", ")", "\n", "defer", "ds", ".", "Unlock", "(", ")", "\n", "}", "\n\n", "// cleanup the ...
// DeleteTree unconditionally deletes a record from the store
[ "DeleteTree", "unconditionally", "deletes", "a", "record", "from", "the", "store" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/datastore/datastore.go#L642-L660
22,413
docker/libnetwork
drivers/remote/driver.go
Init
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { newPluginHandler := func(name string, client *plugins.Client) { // negotiate driver capability with client d := newDriver(name, client) c, err := d.(*driver).getCapabilities() if err != nil { logrus.Errorf("error getting capabilit...
go
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { newPluginHandler := func(name string, client *plugins.Client) { // negotiate driver capability with client d := newDriver(name, client) c, err := d.(*driver).getCapabilities() if err != nil { logrus.Errorf("error getting capabilit...
[ "func", "Init", "(", "dc", "driverapi", ".", "DriverCallback", ",", "config", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "newPluginHandler", ":=", "func", "(", "name", "string", ",", "client", "*", "plugins", ".", "Client", ")",...
// Init makes sure a remote driver is registered when a network driver // plugin is activated.
[ "Init", "makes", "sure", "a", "remote", "driver", "is", "registered", "when", "a", "network", "driver", "plugin", "is", "activated", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/remote/driver.go#L33-L63
22,414
docker/libnetwork
drivers/remote/driver.go
getCapabilities
func (d *driver) getCapabilities() (*driverapi.Capability, error) { var capResp api.GetCapabilityResponse if err := d.call("GetCapabilities", nil, &capResp); err != nil { return nil, err } c := &driverapi.Capability{} switch capResp.Scope { case "global": c.DataScope = datastore.GlobalScope case "local": ...
go
func (d *driver) getCapabilities() (*driverapi.Capability, error) { var capResp api.GetCapabilityResponse if err := d.call("GetCapabilities", nil, &capResp); err != nil { return nil, err } c := &driverapi.Capability{} switch capResp.Scope { case "global": c.DataScope = datastore.GlobalScope case "local": ...
[ "func", "(", "d", "*", "driver", ")", "getCapabilities", "(", ")", "(", "*", "driverapi", ".", "Capability", ",", "error", ")", "{", "var", "capResp", "api", ".", "GetCapabilityResponse", "\n", "if", "err", ":=", "d", ".", "call", "(", "\"", "\"", ",...
// Get capability from client
[ "Get", "capability", "from", "client" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/remote/driver.go#L88-L116
22,415
docker/libnetwork
drivers/remote/driver.go
ProgramExternalConnectivity
func (d *driver) ProgramExternalConnectivity(nid, eid string, options map[string]interface{}) error { data := &api.ProgramExternalConnectivityRequest{ NetworkID: nid, EndpointID: eid, Options: options, } err := d.call("ProgramExternalConnectivity", data, &api.ProgramExternalConnectivityResponse{}) if err ...
go
func (d *driver) ProgramExternalConnectivity(nid, eid string, options map[string]interface{}) error { data := &api.ProgramExternalConnectivityRequest{ NetworkID: nid, EndpointID: eid, Options: options, } err := d.call("ProgramExternalConnectivity", data, &api.ProgramExternalConnectivityResponse{}) if err ...
[ "func", "(", "d", "*", "driver", ")", "ProgramExternalConnectivity", "(", "nid", ",", "eid", "string", ",", "options", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "data", ":=", "&", "api", ".", "ProgramExternalConnectivityRequest", ...
// ProgramExternalConnectivity is invoked to program the rules to allow external connectivity for the endpoint.
[ "ProgramExternalConnectivity", "is", "invoked", "to", "program", "the", "rules", "to", "allow", "external", "connectivity", "for", "the", "endpoint", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/remote/driver.go#L326-L338
22,416
docker/libnetwork
drivers/remote/driver.go
RevokeExternalConnectivity
func (d *driver) RevokeExternalConnectivity(nid, eid string) error { data := &api.RevokeExternalConnectivityRequest{ NetworkID: nid, EndpointID: eid, } err := d.call("RevokeExternalConnectivity", data, &api.RevokeExternalConnectivityResponse{}) if err != nil && plugins.IsNotFound(err) { // It is not mandator...
go
func (d *driver) RevokeExternalConnectivity(nid, eid string) error { data := &api.RevokeExternalConnectivityRequest{ NetworkID: nid, EndpointID: eid, } err := d.call("RevokeExternalConnectivity", data, &api.RevokeExternalConnectivityResponse{}) if err != nil && plugins.IsNotFound(err) { // It is not mandator...
[ "func", "(", "d", "*", "driver", ")", "RevokeExternalConnectivity", "(", "nid", ",", "eid", "string", ")", "error", "{", "data", ":=", "&", "api", ".", "RevokeExternalConnectivityRequest", "{", "NetworkID", ":", "nid", ",", "EndpointID", ":", "eid", ",", "...
// RevokeExternalConnectivity method is invoked to remove any external connectivity programming related to the endpoint.
[ "RevokeExternalConnectivity", "method", "is", "invoked", "to", "remove", "any", "external", "connectivity", "programming", "related", "to", "the", "endpoint", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/remote/driver.go#L341-L352
22,417
docker/libnetwork
drivers/remote/driver.go
parseInterface
func parseInterface(r api.CreateEndpointResponse) (*api.Interface, error) { var outIf *api.Interface inIf := r.Interface if inIf != nil { var err error outIf = &api.Interface{} if inIf.Address != "" { if outIf.Address, err = types.ParseCIDR(inIf.Address); err != nil { return nil, err } } if inIf...
go
func parseInterface(r api.CreateEndpointResponse) (*api.Interface, error) { var outIf *api.Interface inIf := r.Interface if inIf != nil { var err error outIf = &api.Interface{} if inIf.Address != "" { if outIf.Address, err = types.ParseCIDR(inIf.Address); err != nil { return nil, err } } if inIf...
[ "func", "parseInterface", "(", "r", "api", ".", "CreateEndpointResponse", ")", "(", "*", "api", ".", "Interface", ",", "error", ")", "{", "var", "outIf", "*", "api", ".", "Interface", "\n\n", "inIf", ":=", "r", ".", "Interface", "\n", "if", "inIf", "!=...
// parseInterfaces validates all the parameters of an Interface and returns them.
[ "parseInterfaces", "validates", "all", "the", "parameters", "of", "an", "Interface", "and", "returns", "them", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/remote/driver.go#L411-L436
22,418
docker/libnetwork
cmd/proxy/udp_proxy.go
Close
func (proxy *UDPProxy) Close() { proxy.listener.Close() proxy.connTrackLock.Lock() defer proxy.connTrackLock.Unlock() for _, conn := range proxy.connTrackTable { conn.Close() } }
go
func (proxy *UDPProxy) Close() { proxy.listener.Close() proxy.connTrackLock.Lock() defer proxy.connTrackLock.Unlock() for _, conn := range proxy.connTrackTable { conn.Close() } }
[ "func", "(", "proxy", "*", "UDPProxy", ")", "Close", "(", ")", "{", "proxy", ".", "listener", ".", "Close", "(", ")", "\n", "proxy", ".", "connTrackLock", ".", "Lock", "(", ")", "\n", "defer", "proxy", ".", "connTrackLock", ".", "Unlock", "(", ")", ...
// Close stops forwarding the traffic.
[ "Close", "stops", "forwarding", "the", "traffic", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/cmd/proxy/udp_proxy.go#L145-L152
22,419
docker/libnetwork
agent.go
getKeys
func (c *controller) getKeys(subsys string) ([][]byte, []uint64) { c.Lock() defer c.Unlock() sort.Sort(ByTime(c.keys)) keys := [][]byte{} tags := []uint64{} for _, key := range c.keys { if key.Subsystem == subsys { keys = append(keys, key.Key) tags = append(tags, key.LamportTime) } } keys[0], keys[...
go
func (c *controller) getKeys(subsys string) ([][]byte, []uint64) { c.Lock() defer c.Unlock() sort.Sort(ByTime(c.keys)) keys := [][]byte{} tags := []uint64{} for _, key := range c.keys { if key.Subsystem == subsys { keys = append(keys, key.Key) tags = append(tags, key.LamportTime) } } keys[0], keys[...
[ "func", "(", "c", "*", "controller", ")", "getKeys", "(", "subsys", "string", ")", "(", "[", "]", "[", "]", "byte", ",", "[", "]", "uint64", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n\n", "sort", "....
// For a given subsystem getKeys sorts the keys by lamport time and returns // slice of keys and lamport time which can used as a unique tag for the keys
[ "For", "a", "given", "subsystem", "getKeys", "sorts", "the", "keys", "by", "lamport", "time", "and", "returns", "slice", "of", "keys", "and", "lamport", "time", "which", "can", "used", "as", "a", "unique", "tag", "for", "the", "keys" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/agent.go#L241-L259
22,420
docker/libnetwork
agent.go
getPrimaryKeyTag
func (c *controller) getPrimaryKeyTag(subsys string) ([]byte, uint64, error) { c.Lock() defer c.Unlock() sort.Sort(ByTime(c.keys)) keys := []*types.EncryptionKey{} for _, key := range c.keys { if key.Subsystem == subsys { keys = append(keys, key) } } return keys[1].Key, keys[1].LamportTime, nil }
go
func (c *controller) getPrimaryKeyTag(subsys string) ([]byte, uint64, error) { c.Lock() defer c.Unlock() sort.Sort(ByTime(c.keys)) keys := []*types.EncryptionKey{} for _, key := range c.keys { if key.Subsystem == subsys { keys = append(keys, key) } } return keys[1].Key, keys[1].LamportTime, nil }
[ "func", "(", "c", "*", "controller", ")", "getPrimaryKeyTag", "(", "subsys", "string", ")", "(", "[", "]", "byte", ",", "uint64", ",", "error", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "sort", ".", ...
// getPrimaryKeyTag returns the primary key for a given subsystem from the // list of sorted key and the associated tag
[ "getPrimaryKeyTag", "returns", "the", "primary", "key", "for", "a", "given", "subsystem", "from", "the", "list", "of", "sorted", "key", "and", "the", "associated", "tag" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/agent.go#L263-L274
22,421
docker/libnetwork
drivers/ipvlan/ipvlan_joinleave.go
getSubnetforIPv4
func (n *network) getSubnetforIPv4(ip *net.IPNet) *ipv4Subnet { for _, s := range n.config.Ipv4Subnets { _, snet, err := net.ParseCIDR(s.SubnetIP) if err != nil { return nil } // first check if the mask lengths are the same i, _ := snet.Mask.Size() j, _ := ip.Mask.Size() if i != j { continue } ...
go
func (n *network) getSubnetforIPv4(ip *net.IPNet) *ipv4Subnet { for _, s := range n.config.Ipv4Subnets { _, snet, err := net.ParseCIDR(s.SubnetIP) if err != nil { return nil } // first check if the mask lengths are the same i, _ := snet.Mask.Size() j, _ := ip.Mask.Size() if i != j { continue } ...
[ "func", "(", "n", "*", "network", ")", "getSubnetforIPv4", "(", "ip", "*", "net", ".", "IPNet", ")", "*", "ipv4Subnet", "{", "for", "_", ",", "s", ":=", "range", "n", ".", "config", ".", "Ipv4Subnets", "{", "_", ",", "snet", ",", "err", ":=", "ne...
// getSubnetforIPv4 returns the ipv4 subnet to which the given IP belongs
[ "getSubnetforIPv4", "returns", "the", "ipv4", "subnet", "to", "which", "the", "given", "IP", "belongs" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_joinleave.go#L160-L178
22,422
docker/libnetwork
drivers/ipvlan/ipvlan_joinleave.go
getSubnetforIPv6
func (n *network) getSubnetforIPv6(ip *net.IPNet) *ipv6Subnet { for _, s := range n.config.Ipv6Subnets { _, snet, err := net.ParseCIDR(s.SubnetIP) if err != nil { return nil } // first check if the mask lengths are the same i, _ := snet.Mask.Size() j, _ := ip.Mask.Size() if i != j { continue } ...
go
func (n *network) getSubnetforIPv6(ip *net.IPNet) *ipv6Subnet { for _, s := range n.config.Ipv6Subnets { _, snet, err := net.ParseCIDR(s.SubnetIP) if err != nil { return nil } // first check if the mask lengths are the same i, _ := snet.Mask.Size() j, _ := ip.Mask.Size() if i != j { continue } ...
[ "func", "(", "n", "*", "network", ")", "getSubnetforIPv6", "(", "ip", "*", "net", ".", "IPNet", ")", "*", "ipv6Subnet", "{", "for", "_", ",", "s", ":=", "range", "n", ".", "config", ".", "Ipv6Subnets", "{", "_", ",", "snet", ",", "err", ":=", "ne...
// getSubnetforIPv6 returns the ipv6 subnet to which the given IP belongs
[ "getSubnetforIPv6", "returns", "the", "ipv6", "subnet", "to", "which", "the", "given", "IP", "belongs" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_joinleave.go#L181-L199
22,423
docker/libnetwork
client/mflag/flag.go
Out
func (fs *FlagSet) Out() io.Writer { if fs.output == nil { return os.Stderr } return fs.output }
go
func (fs *FlagSet) Out() io.Writer { if fs.output == nil { return os.Stderr } return fs.output }
[ "func", "(", "fs", "*", "FlagSet", ")", "Out", "(", ")", "io", ".", "Writer", "{", "if", "fs", ".", "output", "==", "nil", "{", "return", "os", ".", "Stderr", "\n", "}", "\n", "return", "fs", ".", "output", "\n", "}" ]
// Out returns the destination for usage and error messages.
[ "Out", "returns", "the", "destination", "for", "usage", "and", "error", "messages", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L384-L389
22,424
docker/libnetwork
client/mflag/flag.go
IsSet
func (fs *FlagSet) IsSet(name string) bool { return fs.actual[name] != nil }
go
func (fs *FlagSet) IsSet(name string) bool { return fs.actual[name] != nil }
[ "func", "(", "fs", "*", "FlagSet", ")", "IsSet", "(", "name", "string", ")", "bool", "{", "return", "fs", ".", "actual", "[", "name", "]", "!=", "nil", "\n", "}" ]
// IsSet indicates whether the specified flag is set in the given FlagSet
[ "IsSet", "indicates", "whether", "the", "specified", "flag", "is", "set", "in", "the", "given", "FlagSet" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L431-L433
22,425
docker/libnetwork
client/mflag/flag.go
Set
func (fs *FlagSet) Set(name, value string) error { flag, ok := fs.formal[name] if !ok { return fmt.Errorf("no such flag -%v", name) } if err := flag.Value.Set(value); err != nil { return err } if fs.actual == nil { fs.actual = make(map[string]*Flag) } fs.actual[name] = flag return nil }
go
func (fs *FlagSet) Set(name, value string) error { flag, ok := fs.formal[name] if !ok { return fmt.Errorf("no such flag -%v", name) } if err := flag.Value.Set(value); err != nil { return err } if fs.actual == nil { fs.actual = make(map[string]*Flag) } fs.actual[name] = flag return nil }
[ "func", "(", "fs", "*", "FlagSet", ")", "Set", "(", "name", ",", "value", "string", ")", "error", "{", "flag", ",", "ok", ":=", "fs", ".", "formal", "[", "name", "]", "\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// Set sets the value of the named flag.
[ "Set", "sets", "the", "value", "of", "the", "named", "flag", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L503-L516
22,426
docker/libnetwork
client/mflag/flag.go
PrintDefaults
func (fs *FlagSet) PrintDefaults() { writer := tabwriter.NewWriter(fs.Out(), 20, 1, 3, ' ', 0) home := homedir.Get() // Don't substitute when HOME is / if runtime.GOOS != "windows" && home == "/" { home = "" } // Add a blank line between cmd description and list of options if fs.FlagCount() > 0 { fmt.Fprin...
go
func (fs *FlagSet) PrintDefaults() { writer := tabwriter.NewWriter(fs.Out(), 20, 1, 3, ' ', 0) home := homedir.Get() // Don't substitute when HOME is / if runtime.GOOS != "windows" && home == "/" { home = "" } // Add a blank line between cmd description and list of options if fs.FlagCount() > 0 { fmt.Fprin...
[ "func", "(", "fs", "*", "FlagSet", ")", "PrintDefaults", "(", ")", "{", "writer", ":=", "tabwriter", ".", "NewWriter", "(", "fs", ".", "Out", "(", ")", ",", "20", ",", "1", ",", "3", ",", "' '", ",", "0", ")", "\n", "home", ":=", "homedir", "."...
// PrintDefaults prints, to standard error unless configured // otherwise, the default values of all defined flags in the set.
[ "PrintDefaults", "prints", "to", "standard", "error", "unless", "configured", "otherwise", "the", "default", "values", "of", "all", "defined", "flags", "in", "the", "set", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L539-L580
22,427
docker/libnetwork
client/mflag/flag.go
FlagCountUndeprecated
func (fs *FlagSet) FlagCountUndeprecated() int { count := 0 for _, flag := range sortFlags(fs.formal) { for _, name := range flag.Names { if name[0] != '#' { count++ break } } } return count }
go
func (fs *FlagSet) FlagCountUndeprecated() int { count := 0 for _, flag := range sortFlags(fs.formal) { for _, name := range flag.Names { if name[0] != '#' { count++ break } } } return count }
[ "func", "(", "fs", "*", "FlagSet", ")", "FlagCountUndeprecated", "(", ")", "int", "{", "count", ":=", "0", "\n", "for", "_", ",", "flag", ":=", "range", "sortFlags", "(", "fs", ".", "formal", ")", "{", "for", "_", ",", "name", ":=", "range", "flag"...
// FlagCountUndeprecated returns the number of undeprecated flags that have been defined.
[ "FlagCountUndeprecated", "returns", "the", "number", "of", "undeprecated", "flags", "that", "have", "been", "defined", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L618-L629
22,428
docker/libnetwork
client/mflag/flag.go
usage
func (fs *FlagSet) usage() { if fs == CommandLine { Usage() } else if fs.Usage == nil { defaultUsage(fs) } else { fs.Usage() } }
go
func (fs *FlagSet) usage() { if fs == CommandLine { Usage() } else if fs.Usage == nil { defaultUsage(fs) } else { fs.Usage() } }
[ "func", "(", "fs", "*", "FlagSet", ")", "usage", "(", ")", "{", "if", "fs", "==", "CommandLine", "{", "Usage", "(", ")", "\n", "}", "else", "if", "fs", ".", "Usage", "==", "nil", "{", "defaultUsage", "(", "fs", ")", "\n", "}", "else", "{", "fs"...
// usage calls the Usage method for the flag set, or the usage function if // the flag set is CommandLine.
[ "usage", "calls", "the", "Usage", "method", "for", "the", "flag", "set", "or", "the", "usage", "function", "if", "the", "flag", "set", "is", "CommandLine", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L952-L960
22,429
docker/libnetwork
client/mflag/flag.go
ReportError
func (fs *FlagSet) ReportError(str string, withHelp bool) { if withHelp { if os.Args[0] == fs.Name() { str += ".\nSee '" + os.Args[0] + " --help'" } else { str += ".\nSee '" + os.Args[0] + " " + fs.Name() + " --help'" } } fmt.Fprintf(fs.Out(), "%s: %s.\n", os.Args[0], str) }
go
func (fs *FlagSet) ReportError(str string, withHelp bool) { if withHelp { if os.Args[0] == fs.Name() { str += ".\nSee '" + os.Args[0] + " --help'" } else { str += ".\nSee '" + os.Args[0] + " " + fs.Name() + " --help'" } } fmt.Fprintf(fs.Out(), "%s: %s.\n", os.Args[0], str) }
[ "func", "(", "fs", "*", "FlagSet", ")", "ReportError", "(", "str", "string", ",", "withHelp", "bool", ")", "{", "if", "withHelp", "{", "if", "os", ".", "Args", "[", "0", "]", "==", "fs", ".", "Name", "(", ")", "{", "str", "+=", "\"", "\\n", "\"...
// ReportError is a utility method that prints a user-friendly message // containing the error that occurred during parsing and a suggestion to get help
[ "ReportError", "is", "a", "utility", "method", "that", "prints", "a", "user", "-", "friendly", "message", "containing", "the", "error", "that", "occurred", "during", "parsing", "and", "a", "suggestion", "to", "get", "help" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L1158-L1167
22,430
docker/libnetwork
client/mflag/flag.go
Name
func (v mergeVal) Name() string { type namedValue interface { Name() string } if nVal, ok := v.Value.(namedValue); ok { return nVal.Name() } return v.key }
go
func (v mergeVal) Name() string { type namedValue interface { Name() string } if nVal, ok := v.Value.(namedValue); ok { return nVal.Name() } return v.key }
[ "func", "(", "v", "mergeVal", ")", "Name", "(", ")", "string", "{", "type", "namedValue", "interface", "{", "Name", "(", ")", "string", "\n", "}", "\n", "if", "nVal", ",", "ok", ":=", "v", ".", "Value", ".", "(", "namedValue", ")", ";", "ok", "{"...
// Name returns the name of a mergeVal. // If the original value had a name, return the original name, // otherwise, return the key assigned to this mergeVal.
[ "Name", "returns", "the", "name", "of", "a", "mergeVal", ".", "If", "the", "original", "value", "had", "a", "name", "return", "the", "original", "name", "otherwise", "return", "the", "key", "assigned", "to", "this", "mergeVal", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L1229-L1237
22,431
docker/libnetwork
client/mflag/flag.go
Merge
func Merge(dest *FlagSet, flagsets ...*FlagSet) error { for _, fset := range flagsets { if fset.formal == nil { continue } for k, f := range fset.formal { if _, ok := dest.formal[k]; ok { var err error if fset.name == "" { err = fmt.Errorf("flag redefined: %s", k) } else { err = fmt.E...
go
func Merge(dest *FlagSet, flagsets ...*FlagSet) error { for _, fset := range flagsets { if fset.formal == nil { continue } for k, f := range fset.formal { if _, ok := dest.formal[k]; ok { var err error if fset.name == "" { err = fmt.Errorf("flag redefined: %s", k) } else { err = fmt.E...
[ "func", "Merge", "(", "dest", "*", "FlagSet", ",", "flagsets", "...", "*", "FlagSet", ")", "error", "{", "for", "_", ",", "fset", ":=", "range", "flagsets", "{", "if", "fset", ".", "formal", "==", "nil", "{", "continue", "\n", "}", "\n", "for", "k"...
// Merge is an helper function that merges n FlagSets into a single dest FlagSet // In case of name collision between the flagsets it will apply // the destination FlagSet's errorHandling behavior.
[ "Merge", "is", "an", "helper", "function", "that", "merges", "n", "FlagSets", "into", "a", "single", "dest", "FlagSet", "In", "case", "of", "name", "collision", "between", "the", "flagsets", "it", "will", "apply", "the", "destination", "FlagSet", "s", "error...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/mflag/flag.go#L1242-L1275
22,432
docker/libnetwork
sandbox_dns_unix.go
rebuildDNS
func (sb *sandbox) rebuildDNS() error { currRC, err := resolvconf.GetSpecific(sb.config.resolvConfPath) if err != nil { return err } if len(sb.extDNS) == 0 { sb.setExternalResolvers(currRC.Content, types.IPv4, false) } var ( dnsList = []string{sb.resolver.NameServer()} dnsOptionsList = resolvconf....
go
func (sb *sandbox) rebuildDNS() error { currRC, err := resolvconf.GetSpecific(sb.config.resolvConfPath) if err != nil { return err } if len(sb.extDNS) == 0 { sb.setExternalResolvers(currRC.Content, types.IPv4, false) } var ( dnsList = []string{sb.resolver.NameServer()} dnsOptionsList = resolvconf....
[ "func", "(", "sb", "*", "sandbox", ")", "rebuildDNS", "(", ")", "error", "{", "currRC", ",", "err", ":=", "resolvconf", ".", "GetSpecific", "(", "sb", ".", "config", ".", "resolvConfPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\...
// Embedded DNS server has to be enabled for this sandbox. Rebuild the container's // resolv.conf by doing the following // - Add only the embedded server's IP to container's resolv.conf // - If the embedded server needs any resolv.conf options add it to the current list
[ "Embedded", "DNS", "server", "has", "to", "be", "enabled", "for", "this", "sandbox", ".", "Rebuild", "the", "container", "s", "resolv", ".", "conf", "by", "doing", "the", "following", "-", "Add", "only", "the", "embedded", "server", "s", "IP", "to", "con...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/sandbox_dns_unix.go#L351-L405
22,433
docker/libnetwork
client/client.go
NewNetworkCli
func NewNetworkCli(out, err io.Writer, call CallFunc) *NetworkCli { return &NetworkCli{ out: out, err: err, call: call, } }
go
func NewNetworkCli(out, err io.Writer, call CallFunc) *NetworkCli { return &NetworkCli{ out: out, err: err, call: call, } }
[ "func", "NewNetworkCli", "(", "out", ",", "err", "io", ".", "Writer", ",", "call", "CallFunc", ")", "*", "NetworkCli", "{", "return", "&", "NetworkCli", "{", "out", ":", "out", ",", "err", ":", "err", ",", "call", ":", "call", ",", "}", "\n", "}" ]
// NewNetworkCli is a convenient function to create a NetworkCli object
[ "NewNetworkCli", "is", "a", "convenient", "function", "to", "create", "a", "NetworkCli", "object" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/client.go#L25-L31
22,434
docker/libnetwork
client/client.go
getMethod
func (cli *NetworkCli) getMethod(args ...string) (func(string, ...string) error, bool) { camelArgs := make([]string, len(args)) for i, s := range args { if len(s) == 0 { return nil, false } camelArgs[i] = strings.ToUpper(s[:1]) + strings.ToLower(s[1:]) } methodName := "Cmd" + strings.Join(camelArgs, "") m...
go
func (cli *NetworkCli) getMethod(args ...string) (func(string, ...string) error, bool) { camelArgs := make([]string, len(args)) for i, s := range args { if len(s) == 0 { return nil, false } camelArgs[i] = strings.ToUpper(s[:1]) + strings.ToLower(s[1:]) } methodName := "Cmd" + strings.Join(camelArgs, "") m...
[ "func", "(", "cli", "*", "NetworkCli", ")", "getMethod", "(", "args", "...", "string", ")", "(", "func", "(", "string", ",", "...", "string", ")", "error", ",", "bool", ")", "{", "camelArgs", ":=", "make", "(", "[", "]", "string", ",", "len", "(", ...
// getMethod is Borrowed from Docker UI which uses reflection to identify the UI Handler
[ "getMethod", "is", "Borrowed", "from", "Docker", "UI", "which", "uses", "reflection", "to", "identify", "the", "UI", "Handler" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/client.go#L34-L48
22,435
docker/libnetwork
client/client.go
Cmd
func (cli *NetworkCli) Cmd(chain string, args ...string) error { if len(args) > 2 { method, exists := cli.getMethod(args[:3]...) if exists { return method(chain+" "+args[0]+" "+args[1], args[3:]...) } } if len(args) > 1 { method, exists := cli.getMethod(args[:2]...) if exists { return method(chain+" ...
go
func (cli *NetworkCli) Cmd(chain string, args ...string) error { if len(args) > 2 { method, exists := cli.getMethod(args[:3]...) if exists { return method(chain+" "+args[0]+" "+args[1], args[3:]...) } } if len(args) > 1 { method, exists := cli.getMethod(args[:2]...) if exists { return method(chain+" ...
[ "func", "(", "cli", "*", "NetworkCli", ")", "Cmd", "(", "chain", "string", ",", "args", "...", "string", ")", "error", "{", "if", "len", "(", "args", ")", ">", "2", "{", "method", ",", "exists", ":=", "cli", ".", "getMethod", "(", "args", "[", ":...
// Cmd is borrowed from Docker UI and acts as the entry point for network UI commands. // network UI commands are designed to be invoked from multiple parent chains
[ "Cmd", "is", "borrowed", "from", "Docker", "UI", "and", "acts", "as", "the", "entry", "point", "for", "network", "UI", "commands", ".", "network", "UI", "commands", "are", "designed", "to", "be", "invoked", "from", "multiple", "parent", "chains" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/client.go#L52-L74
22,436
docker/libnetwork
client/client.go
Subcmd
func (cli *NetworkCli) Subcmd(chain, name, signature, description string, exitOnError bool) *flag.FlagSet { var errorHandling flag.ErrorHandling if exitOnError { errorHandling = flag.ExitOnError } else { errorHandling = flag.ContinueOnError } flags := flag.NewFlagSet(name, errorHandling) flags.Usage = func() ...
go
func (cli *NetworkCli) Subcmd(chain, name, signature, description string, exitOnError bool) *flag.FlagSet { var errorHandling flag.ErrorHandling if exitOnError { errorHandling = flag.ExitOnError } else { errorHandling = flag.ContinueOnError } flags := flag.NewFlagSet(name, errorHandling) flags.Usage = func() ...
[ "func", "(", "cli", "*", "NetworkCli", ")", "Subcmd", "(", "chain", ",", "name", ",", "signature", ",", "description", "string", ",", "exitOnError", "bool", ")", "*", "flag", ".", "FlagSet", "{", "var", "errorHandling", "flag", ".", "ErrorHandling", "\n", ...
// Subcmd is borrowed from Docker UI and performs the same function of configuring the subCmds
[ "Subcmd", "is", "borrowed", "from", "Docker", "UI", "and", "performs", "the", "same", "function", "of", "configuring", "the", "subCmds" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/client/client.go#L77-L101
22,437
docker/libnetwork
etchosts/etchosts.go
WriteTo
func (r Record) WriteTo(w io.Writer) (int64, error) { n, err := fmt.Fprintf(w, "%s\t%s\n", r.IP, r.Hosts) return int64(n), err }
go
func (r Record) WriteTo(w io.Writer) (int64, error) { n, err := fmt.Fprintf(w, "%s\t%s\n", r.IP, r.Hosts) return int64(n), err }
[ "func", "(", "r", "Record", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "n", ",", "err", ":=", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\\n", "\"", ",", "r", ".", "IP", ",", "r", ".",...
// WriteTo writes record to file and returns bytes written or error
[ "WriteTo", "writes", "record", "to", "file", "and", "returns", "bytes", "written", "or", "error" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/etchosts/etchosts.go#L22-L25
22,438
docker/libnetwork
etchosts/etchosts.go
Drop
func Drop(path string) { pathMutex.Lock() defer pathMutex.Unlock() delete(pathMap, path) }
go
func Drop(path string) { pathMutex.Lock() defer pathMutex.Unlock() delete(pathMap, path) }
[ "func", "Drop", "(", "path", "string", ")", "{", "pathMutex", ".", "Lock", "(", ")", "\n", "defer", "pathMutex", ".", "Unlock", "(", ")", "\n\n", "delete", "(", "pathMap", ",", "path", ")", "\n", "}" ]
// Drop drops the path string from the path cache
[ "Drop", "drops", "the", "path", "string", "from", "the", "path", "cache" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/etchosts/etchosts.go#L63-L68
22,439
docker/libnetwork
etchosts/etchosts.go
Build
func Build(path, IP, hostname, domainname string, extraContent []Record) error { defer pathLock(path)() content := bytes.NewBuffer(nil) if IP != "" { //set main record var mainRec Record mainRec.IP = IP // User might have provided a FQDN in hostname or split it across hostname // and domainname. We want ...
go
func Build(path, IP, hostname, domainname string, extraContent []Record) error { defer pathLock(path)() content := bytes.NewBuffer(nil) if IP != "" { //set main record var mainRec Record mainRec.IP = IP // User might have provided a FQDN in hostname or split it across hostname // and domainname. We want ...
[ "func", "Build", "(", "path", ",", "IP", ",", "hostname", ",", "domainname", "string", ",", "extraContent", "[", "]", "Record", ")", "error", "{", "defer", "pathLock", "(", "path", ")", "(", ")", "\n\n", "content", ":=", "bytes", ".", "NewBuffer", "(",...
// Build function // path is path to host file string required // IP, hostname, and domainname set main record leave empty for no master record // extraContent is an array of extra host records.
[ "Build", "function", "path", "is", "path", "to", "host", "file", "string", "required", "IP", "hostname", "and", "domainname", "set", "main", "record", "leave", "empty", "for", "no", "master", "record", "extraContent", "is", "an", "array", "of", "extra", "hos...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/etchosts/etchosts.go#L74-L112
22,440
docker/libnetwork
etchosts/etchosts.go
Update
func Update(path, IP, hostname string) error { defer pathLock(path)() old, err := ioutil.ReadFile(path) if err != nil { return err } var re = regexp.MustCompile(fmt.Sprintf("(\\S*)(\\t%s)(\\s|\\.)", regexp.QuoteMeta(hostname))) return ioutil.WriteFile(path, re.ReplaceAll(old, []byte(IP+"$2"+"$3")), 0644) }
go
func Update(path, IP, hostname string) error { defer pathLock(path)() old, err := ioutil.ReadFile(path) if err != nil { return err } var re = regexp.MustCompile(fmt.Sprintf("(\\S*)(\\t%s)(\\s|\\.)", regexp.QuoteMeta(hostname))) return ioutil.WriteFile(path, re.ReplaceAll(old, []byte(IP+"$2"+"$3")), 0644) }
[ "func", "Update", "(", "path", ",", "IP", ",", "hostname", "string", ")", "error", "{", "defer", "pathLock", "(", "path", ")", "(", ")", "\n\n", "old", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", ...
// Update all IP addresses where hostname matches. // path is path to host file // IP is new IP address // hostname is hostname to search for to replace IP
[ "Update", "all", "IP", "addresses", "where", "hostname", "matches", ".", "path", "is", "path", "to", "host", "file", "IP", "is", "new", "IP", "address", "hostname", "is", "hostname", "to", "search", "for", "to", "replace", "IP" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/etchosts/etchosts.go#L199-L208
22,441
docker/libnetwork
drivers/overlay/overlay.go
restoreEndpoints
func (d *driver) restoreEndpoints() error { if d.localStore == nil { logrus.Warn("Cannot restore overlay endpoints because local datastore is missing") return nil } kvol, err := d.localStore.List(datastore.Key(overlayEndpointPrefix), &endpoint{}) if err != nil && err != datastore.ErrKeyNotFound { return fmt.E...
go
func (d *driver) restoreEndpoints() error { if d.localStore == nil { logrus.Warn("Cannot restore overlay endpoints because local datastore is missing") return nil } kvol, err := d.localStore.List(datastore.Key(overlayEndpointPrefix), &endpoint{}) if err != nil && err != datastore.ErrKeyNotFound { return fmt.E...
[ "func", "(", "d", "*", "driver", ")", "restoreEndpoints", "(", ")", "error", "{", "if", "d", ".", "localStore", "==", "nil", "{", "logrus", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n", "kvol", ",", "err", ":=", "d", ...
// Endpoints are stored in the local store. Restore them and reconstruct the overlay sandbox
[ "Endpoints", "are", "stored", "in", "the", "local", "store", ".", "Restore", "them", "and", "reconstruct", "the", "overlay", "sandbox" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/overlay.go#L111-L160
22,442
docker/libnetwork
drivers/overlay/overlay.go
Fini
func Fini(drv driverapi.Driver) { d := drv.(*driver) // Notify the peer go routine to return if d.peerOpCancel != nil { d.peerOpCancel() } if d.exitCh != nil { waitCh := make(chan struct{}) d.exitCh <- waitCh <-waitCh } }
go
func Fini(drv driverapi.Driver) { d := drv.(*driver) // Notify the peer go routine to return if d.peerOpCancel != nil { d.peerOpCancel() } if d.exitCh != nil { waitCh := make(chan struct{}) d.exitCh <- waitCh <-waitCh } }
[ "func", "Fini", "(", "drv", "driverapi", ".", "Driver", ")", "{", "d", ":=", "drv", ".", "(", "*", "driver", ")", "\n\n", "// Notify the peer go routine to return", "if", "d", ".", "peerOpCancel", "!=", "nil", "{", "d", ".", "peerOpCancel", "(", ")", "\n...
// Fini cleans up the driver resources
[ "Fini", "cleans", "up", "the", "driver", "resources" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/overlay.go#L163-L178
22,443
docker/libnetwork
drivers/host/host.go
Init
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { c := driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.LocalScope, } return dc.RegisterDriver(networkType, &driver{}, c) }
go
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { c := driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.LocalScope, } return dc.RegisterDriver(networkType, &driver{}, c) }
[ "func", "Init", "(", "dc", "driverapi", ".", "DriverCallback", ",", "config", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "c", ":=", "driverapi", ".", "Capability", "{", "DataScope", ":", "datastore", ".", "LocalScope", ",", "Con...
// Init registers a new instance of host driver
[ "Init", "registers", "a", "new", "instance", "of", "host", "driver" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/host/host.go#L20-L26
22,444
docker/libnetwork
drivers/bridge/interface.go
newInterface
func newInterface(nlh *netlink.Handle, config *networkConfiguration) (*bridgeInterface, error) { var err error i := &bridgeInterface{nlh: nlh} // Initialize the bridge name to the default if unspecified. if config.BridgeName == "" { config.BridgeName = DefaultBridgeName } // Attempt to find an existing bridge...
go
func newInterface(nlh *netlink.Handle, config *networkConfiguration) (*bridgeInterface, error) { var err error i := &bridgeInterface{nlh: nlh} // Initialize the bridge name to the default if unspecified. if config.BridgeName == "" { config.BridgeName = DefaultBridgeName } // Attempt to find an existing bridge...
[ "func", "newInterface", "(", "nlh", "*", "netlink", ".", "Handle", ",", "config", "*", "networkConfiguration", ")", "(", "*", "bridgeInterface", ",", "error", ")", "{", "var", "err", "error", "\n", "i", ":=", "&", "bridgeInterface", "{", "nlh", ":", "nlh...
// newInterface creates a new bridge interface structure. It attempts to find // an already existing device identified by the configuration BridgeName field, // or the default bridge name when unspecified, but doesn't attempt to create // one when missing
[ "newInterface", "creates", "a", "new", "bridge", "interface", "structure", ".", "It", "attempts", "to", "find", "an", "already", "existing", "device", "identified", "by", "the", "configuration", "BridgeName", "field", "or", "the", "default", "bridge", "name", "w...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/interface.go#L31-L48
22,445
docker/libnetwork
drivers/bridge/interface.go
addresses
func (i *bridgeInterface) addresses() ([]netlink.Addr, []netlink.Addr, error) { v4addr, err := i.nlh.AddrList(i.Link, netlink.FAMILY_V4) if err != nil { return nil, nil, fmt.Errorf("Failed to retrieve V4 addresses: %v", err) } v6addr, err := i.nlh.AddrList(i.Link, netlink.FAMILY_V6) if err != nil { return nil...
go
func (i *bridgeInterface) addresses() ([]netlink.Addr, []netlink.Addr, error) { v4addr, err := i.nlh.AddrList(i.Link, netlink.FAMILY_V4) if err != nil { return nil, nil, fmt.Errorf("Failed to retrieve V4 addresses: %v", err) } v6addr, err := i.nlh.AddrList(i.Link, netlink.FAMILY_V6) if err != nil { return nil...
[ "func", "(", "i", "*", "bridgeInterface", ")", "addresses", "(", ")", "(", "[", "]", "netlink", ".", "Addr", ",", "[", "]", "netlink", ".", "Addr", ",", "error", ")", "{", "v4addr", ",", "err", ":=", "i", ".", "nlh", ".", "AddrList", "(", "i", ...
// addresses returns all IPv4 addresses and all IPv6 addresses for the bridge interface.
[ "addresses", "returns", "all", "IPv4", "addresses", "and", "all", "IPv6", "addresses", "for", "the", "bridge", "interface", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/interface.go#L56-L71
22,446
docker/libnetwork
diagnostic/server.go
Init
func (s *Server) Init() { s.mux = http.NewServeMux() // Register local handlers s.RegisterHandler(s, diagPaths2Func) }
go
func (s *Server) Init() { s.mux = http.NewServeMux() // Register local handlers s.RegisterHandler(s, diagPaths2Func) }
[ "func", "(", "s", "*", "Server", ")", "Init", "(", ")", "{", "s", ".", "mux", "=", "http", ".", "NewServeMux", "(", ")", "\n\n", "// Register local handlers", "s", ".", "RegisterHandler", "(", "s", ",", "diagPaths2Func", ")", "\n", "}" ]
// Init initialize the mux for the http handling and register the base hooks
[ "Init", "initialize", "the", "mux", "for", "the", "http", "handling", "and", "register", "the", "base", "hooks" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L55-L60
22,447
docker/libnetwork
diagnostic/server.go
RegisterHandler
func (s *Server) RegisterHandler(ctx interface{}, hdlrs map[string]HTTPHandlerFunc) { s.Lock() defer s.Unlock() for path, fun := range hdlrs { if _, ok := s.registeredHanders[path]; ok { continue } s.mux.Handle(path, httpHandlerCustom{ctx, fun}) s.registeredHanders[path] = true } }
go
func (s *Server) RegisterHandler(ctx interface{}, hdlrs map[string]HTTPHandlerFunc) { s.Lock() defer s.Unlock() for path, fun := range hdlrs { if _, ok := s.registeredHanders[path]; ok { continue } s.mux.Handle(path, httpHandlerCustom{ctx, fun}) s.registeredHanders[path] = true } }
[ "func", "(", "s", "*", "Server", ")", "RegisterHandler", "(", "ctx", "interface", "{", "}", ",", "hdlrs", "map", "[", "string", "]", "HTTPHandlerFunc", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n", "for", ...
// RegisterHandler allows to register new handlers to the mux and to a specific path
[ "RegisterHandler", "allows", "to", "register", "new", "handlers", "to", "the", "mux", "and", "to", "a", "specific", "path" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L63-L73
22,448
docker/libnetwork
diagnostic/server.go
EnableDiagnostic
func (s *Server) EnableDiagnostic(ip string, port int) { s.Lock() defer s.Unlock() s.port = port if s.enable == 1 { logrus.Info("The server is already up and running") return } logrus.Infof("Starting the diagnostic server listening on %d for commands", port) srv := &http.Server{Addr: fmt.Sprintf("%s:%d", ...
go
func (s *Server) EnableDiagnostic(ip string, port int) { s.Lock() defer s.Unlock() s.port = port if s.enable == 1 { logrus.Info("The server is already up and running") return } logrus.Infof("Starting the diagnostic server listening on %d for commands", port) srv := &http.Server{Addr: fmt.Sprintf("%s:%d", ...
[ "func", "(", "s", "*", "Server", ")", "EnableDiagnostic", "(", "ip", "string", ",", "port", "int", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "s", ".", "port", "=", "port", "\n\n", "if", "s", ".",...
// EnableDiagnostic opens a TCP socket to debug the passed network DB
[ "EnableDiagnostic", "opens", "a", "TCP", "socket", "to", "debug", "the", "passed", "network", "DB" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L82-L104
22,449
docker/libnetwork
diagnostic/server.go
DisableDiagnostic
func (s *Server) DisableDiagnostic() { s.Lock() defer s.Unlock() s.srv.Shutdown(context.Background()) s.srv = nil s.enable = 0 logrus.Info("Disabling the diagnostic server") }
go
func (s *Server) DisableDiagnostic() { s.Lock() defer s.Unlock() s.srv.Shutdown(context.Background()) s.srv = nil s.enable = 0 logrus.Info("Disabling the diagnostic server") }
[ "func", "(", "s", "*", "Server", ")", "DisableDiagnostic", "(", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "s", ".", "srv", ".", "Shutdown", "(", "context", ".", "Background", "(", ")", ")", "\n", ...
// DisableDiagnostic stop the dubug and closes the tcp socket
[ "DisableDiagnostic", "stop", "the", "dubug", "and", "closes", "the", "tcp", "socket" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L107-L115
22,450
docker/libnetwork
diagnostic/server.go
IsDiagnosticEnabled
func (s *Server) IsDiagnosticEnabled() bool { s.Lock() defer s.Unlock() return s.enable == 1 }
go
func (s *Server) IsDiagnosticEnabled() bool { s.Lock() defer s.Unlock() return s.enable == 1 }
[ "func", "(", "s", "*", "Server", ")", "IsDiagnosticEnabled", "(", ")", "bool", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n", "return", "s", ".", "enable", "==", "1", "\n", "}" ]
// IsDiagnosticEnabled returns true when the debug is enabled
[ "IsDiagnosticEnabled", "returns", "true", "when", "the", "debug", "is", "enabled" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L118-L122
22,451
docker/libnetwork
diagnostic/server.go
DebugHTTPForm
func DebugHTTPForm(r *http.Request) { for k, v := range r.Form { logrus.Debugf("Form[%q] = %q\n", k, v) } }
go
func DebugHTTPForm(r *http.Request) { for k, v := range r.Form { logrus.Debugf("Form[%q] = %q\n", k, v) } }
[ "func", "DebugHTTPForm", "(", "r", "*", "http", ".", "Request", ")", "{", "for", "k", ",", "v", ":=", "range", "r", ".", "Form", "{", "logrus", ".", "Debugf", "(", "\"", "\\n", "\"", ",", "k", ",", "v", ")", "\n", "}", "\n", "}" ]
// DebugHTTPForm helper to print the form url parameters
[ "DebugHTTPForm", "helper", "to", "print", "the", "form", "url", "parameters" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L183-L187
22,452
docker/libnetwork
diagnostic/server.go
ParseHTTPFormOptions
func ParseHTTPFormOptions(r *http.Request) (bool, *JSONOutput) { _, unsafe := r.Form["unsafe"] v, json := r.Form["json"] var pretty bool if len(v) > 0 { pretty = v[0] == "pretty" } return unsafe, &JSONOutput{enable: json, prettyPrint: pretty} }
go
func ParseHTTPFormOptions(r *http.Request) (bool, *JSONOutput) { _, unsafe := r.Form["unsafe"] v, json := r.Form["json"] var pretty bool if len(v) > 0 { pretty = v[0] == "pretty" } return unsafe, &JSONOutput{enable: json, prettyPrint: pretty} }
[ "func", "ParseHTTPFormOptions", "(", "r", "*", "http", ".", "Request", ")", "(", "bool", ",", "*", "JSONOutput", ")", "{", "_", ",", "unsafe", ":=", "r", ".", "Form", "[", "\"", "\"", "]", "\n", "v", ",", "json", ":=", "r", ".", "Form", "[", "\...
// ParseHTTPFormOptions easily parse the JSON printing options
[ "ParseHTTPFormOptions", "easily", "parse", "the", "JSON", "printing", "options" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L196-L204
22,453
docker/libnetwork
diagnostic/server.go
HTTPReply
func HTTPReply(w http.ResponseWriter, r *HTTPResult, j *JSONOutput) (int, error) { var response []byte if j.enable { w.Header().Set("Content-Type", "application/json") var err error if j.prettyPrint { response, err = json.MarshalIndent(r, "", " ") if err != nil { response, _ = json.MarshalIndent(Fail...
go
func HTTPReply(w http.ResponseWriter, r *HTTPResult, j *JSONOutput) (int, error) { var response []byte if j.enable { w.Header().Set("Content-Type", "application/json") var err error if j.prettyPrint { response, err = json.MarshalIndent(r, "", " ") if err != nil { response, _ = json.MarshalIndent(Fail...
[ "func", "HTTPReply", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "HTTPResult", ",", "j", "*", "JSONOutput", ")", "(", "int", ",", "error", ")", "{", "var", "response", "[", "]", "byte", "\n", "if", "j", ".", "enable", "{", "w", ".", "...
// HTTPReply helper function that takes care of sending the message out
[ "HTTPReply", "helper", "function", "that", "takes", "care", "of", "sending", "the", "message", "out" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/server.go#L207-L227
22,454
docker/libnetwork
ipams/remote/remote.go
GetDefaultAddressSpaces
func (a *allocator) GetDefaultAddressSpaces() (string, string, error) { res := &api.GetAddressSpacesResponse{} if err := a.call("GetDefaultAddressSpaces", nil, res); err != nil { return "", "", err } return res.LocalDefaultAddressSpace, res.GlobalDefaultAddressSpace, nil }
go
func (a *allocator) GetDefaultAddressSpaces() (string, string, error) { res := &api.GetAddressSpacesResponse{} if err := a.call("GetDefaultAddressSpaces", nil, res); err != nil { return "", "", err } return res.LocalDefaultAddressSpace, res.GlobalDefaultAddressSpace, nil }
[ "func", "(", "a", "*", "allocator", ")", "GetDefaultAddressSpaces", "(", ")", "(", "string", ",", "string", ",", "error", ")", "{", "res", ":=", "&", "api", ".", "GetAddressSpacesResponse", "{", "}", "\n", "if", "err", ":=", "a", ".", "call", "(", "\...
// GetDefaultAddressSpaces returns the local and global default address spaces
[ "GetDefaultAddressSpaces", "returns", "the", "local", "and", "global", "default", "address", "spaces" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/remote/remote.go#L111-L117
22,455
docker/libnetwork
ipams/remote/remote.go
RequestPool
func (a *allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) { req := &api.RequestPoolRequest{AddressSpace: addressSpace, Pool: pool, SubPool: subPool, Options: options, V6: v6} res := &api.RequestPoolResponse{} if err := a.cal...
go
func (a *allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) { req := &api.RequestPoolRequest{AddressSpace: addressSpace, Pool: pool, SubPool: subPool, Options: options, V6: v6} res := &api.RequestPoolResponse{} if err := a.cal...
[ "func", "(", "a", "*", "allocator", ")", "RequestPool", "(", "addressSpace", ",", "pool", ",", "subPool", "string", ",", "options", "map", "[", "string", "]", "string", ",", "v6", "bool", ")", "(", "string", ",", "*", "net", ".", "IPNet", ",", "map",...
// RequestPool requests an address pool in the specified address space
[ "RequestPool", "requests", "an", "address", "pool", "in", "the", "specified", "address", "space" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/remote/remote.go#L120-L128
22,456
docker/libnetwork
ipams/remote/remote.go
ReleasePool
func (a *allocator) ReleasePool(poolID string) error { req := &api.ReleasePoolRequest{PoolID: poolID} res := &api.ReleasePoolResponse{} return a.call("ReleasePool", req, res) }
go
func (a *allocator) ReleasePool(poolID string) error { req := &api.ReleasePoolRequest{PoolID: poolID} res := &api.ReleasePoolResponse{} return a.call("ReleasePool", req, res) }
[ "func", "(", "a", "*", "allocator", ")", "ReleasePool", "(", "poolID", "string", ")", "error", "{", "req", ":=", "&", "api", ".", "ReleasePoolRequest", "{", "PoolID", ":", "poolID", "}", "\n", "res", ":=", "&", "api", ".", "ReleasePoolResponse", "{", "...
// ReleasePool removes an address pool from the specified address space
[ "ReleasePool", "removes", "an", "address", "pool", "from", "the", "specified", "address", "space" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/remote/remote.go#L131-L135
22,457
docker/libnetwork
ipams/remote/remote.go
RequestAddress
func (a *allocator) RequestAddress(poolID string, address net.IP, options map[string]string) (*net.IPNet, map[string]string, error) { var ( prefAddress string retAddress *net.IPNet err error ) if address != nil { prefAddress = address.String() } req := &api.RequestAddressRequest{PoolID: poolID, Ad...
go
func (a *allocator) RequestAddress(poolID string, address net.IP, options map[string]string) (*net.IPNet, map[string]string, error) { var ( prefAddress string retAddress *net.IPNet err error ) if address != nil { prefAddress = address.String() } req := &api.RequestAddressRequest{PoolID: poolID, Ad...
[ "func", "(", "a", "*", "allocator", ")", "RequestAddress", "(", "poolID", "string", ",", "address", "net", ".", "IP", ",", "options", "map", "[", "string", "]", "string", ")", "(", "*", "net", ".", "IPNet", ",", "map", "[", "string", "]", "string", ...
// RequestAddress requests an address from the address pool
[ "RequestAddress", "requests", "an", "address", "from", "the", "address", "pool" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/remote/remote.go#L138-L158
22,458
docker/libnetwork
ipams/remote/remote.go
ReleaseAddress
func (a *allocator) ReleaseAddress(poolID string, address net.IP) error { var relAddress string if address != nil { relAddress = address.String() } req := &api.ReleaseAddressRequest{PoolID: poolID, Address: relAddress} res := &api.ReleaseAddressResponse{} return a.call("ReleaseAddress", req, res) }
go
func (a *allocator) ReleaseAddress(poolID string, address net.IP) error { var relAddress string if address != nil { relAddress = address.String() } req := &api.ReleaseAddressRequest{PoolID: poolID, Address: relAddress} res := &api.ReleaseAddressResponse{} return a.call("ReleaseAddress", req, res) }
[ "func", "(", "a", "*", "allocator", ")", "ReleaseAddress", "(", "poolID", "string", ",", "address", "net", ".", "IP", ")", "error", "{", "var", "relAddress", "string", "\n", "if", "address", "!=", "nil", "{", "relAddress", "=", "address", ".", "String", ...
// ReleaseAddress releases the address from the specified address pool
[ "ReleaseAddress", "releases", "the", "address", "from", "the", "specified", "address", "pool" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/ipams/remote/remote.go#L161-L169
22,459
docker/libnetwork
diagnostic/types.go
FailCommand
func FailCommand(err error) *HTTPResult { return &HTTPResult{ Message: "FAIL", Details: &ErrorCmd{Error: err.Error()}, } }
go
func FailCommand(err error) *HTTPResult { return &HTTPResult{ Message: "FAIL", Details: &ErrorCmd{Error: err.Error()}, } }
[ "func", "FailCommand", "(", "err", "error", ")", "*", "HTTPResult", "{", "return", "&", "HTTPResult", "{", "Message", ":", "\"", "\"", ",", "Details", ":", "&", "ErrorCmd", "{", "Error", ":", "err", ".", "Error", "(", ")", "}", ",", "}", "\n", "}" ...
// FailCommand creates a failure message with error
[ "FailCommand", "creates", "a", "failure", "message", "with", "error" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/types.go#L19-L24
22,460
docker/libnetwork
diagnostic/types.go
WrongCommand
func WrongCommand(message, usage string) *HTTPResult { return &HTTPResult{ Message: message, Details: &UsageCmd{Usage: usage}, } }
go
func WrongCommand(message, usage string) *HTTPResult { return &HTTPResult{ Message: message, Details: &UsageCmd{Usage: usage}, } }
[ "func", "WrongCommand", "(", "message", ",", "usage", "string", ")", "*", "HTTPResult", "{", "return", "&", "HTTPResult", "{", "Message", ":", "message", ",", "Details", ":", "&", "UsageCmd", "{", "Usage", ":", "usage", "}", ",", "}", "\n", "}" ]
// WrongCommand creates a wrong command response
[ "WrongCommand", "creates", "a", "wrong", "command", "response" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/diagnostic/types.go#L27-L32
22,461
docker/libnetwork
drivers/bridge/bridge.go
Init
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { d := newDriver() if err := d.configure(config); err != nil { return err } c := driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.LocalScope, } return dc.RegisterDriver(networkType, d, c) ...
go
func Init(dc driverapi.DriverCallback, config map[string]interface{}) error { d := newDriver() if err := d.configure(config); err != nil { return err } c := driverapi.Capability{ DataScope: datastore.LocalScope, ConnectivityScope: datastore.LocalScope, } return dc.RegisterDriver(networkType, d, c) ...
[ "func", "Init", "(", "dc", "driverapi", ".", "DriverCallback", ",", "config", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "d", ":=", "newDriver", "(", ")", "\n", "if", "err", ":=", "d", ".", "configure", "(", "config", ")", ...
// Init registers a new instance of bridge driver
[ "Init", "registers", "a", "new", "instance", "of", "bridge", "driver" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/bridge.go#L159-L170
22,462
docker/libnetwork
drivers/bridge/bridge.go
Validate
func (c *networkConfiguration) Validate() error { if c.Mtu < 0 { return ErrInvalidMtu(c.Mtu) } // If bridge v4 subnet is specified if c.AddressIPv4 != nil { // If default gw is specified, it must be part of bridge subnet if c.DefaultGatewayIPv4 != nil { if !c.AddressIPv4.Contains(c.DefaultGatewayIPv4) { ...
go
func (c *networkConfiguration) Validate() error { if c.Mtu < 0 { return ErrInvalidMtu(c.Mtu) } // If bridge v4 subnet is specified if c.AddressIPv4 != nil { // If default gw is specified, it must be part of bridge subnet if c.DefaultGatewayIPv4 != nil { if !c.AddressIPv4.Contains(c.DefaultGatewayIPv4) { ...
[ "func", "(", "c", "*", "networkConfiguration", ")", "Validate", "(", ")", "error", "{", "if", "c", ".", "Mtu", "<", "0", "{", "return", "ErrInvalidMtu", "(", "c", ".", "Mtu", ")", "\n", "}", "\n\n", "// If bridge v4 subnet is specified", "if", "c", ".", ...
// Validate performs a static validation on the network configuration parameters. // Whatever can be assessed a priori before attempting any programming.
[ "Validate", "performs", "a", "static", "validation", "on", "the", "network", "configuration", "parameters", ".", "Whatever", "can", "be", "assessed", "a", "priori", "before", "attempting", "any", "programming", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/bridge.go#L174-L196
22,463
docker/libnetwork
drivers/bridge/bridge.go
Conflicts
func (c *networkConfiguration) Conflicts(o *networkConfiguration) error { if o == nil { return errors.New("same configuration") } // Also empty, because only one network with empty name is allowed if c.BridgeName == o.BridgeName { return errors.New("networks have same bridge name") } // They must be in diff...
go
func (c *networkConfiguration) Conflicts(o *networkConfiguration) error { if o == nil { return errors.New("same configuration") } // Also empty, because only one network with empty name is allowed if c.BridgeName == o.BridgeName { return errors.New("networks have same bridge name") } // They must be in diff...
[ "func", "(", "c", "*", "networkConfiguration", ")", "Conflicts", "(", "o", "*", "networkConfiguration", ")", "error", "{", "if", "o", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Also empty, because only on...
// Conflicts check if two NetworkConfiguration objects overlap
[ "Conflicts", "check", "if", "two", "NetworkConfiguration", "objects", "overlap" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/bridge.go#L199-L222
22,464
docker/libnetwork
drivers/bridge/bridge.go
getV6Network
func getV6Network(config *networkConfiguration, i *bridgeInterface) *net.IPNet { if config.AddressIPv6 != nil { return config.AddressIPv6 } if i.bridgeIPv6 != nil && i.bridgeIPv6.IP != nil && !i.bridgeIPv6.IP.IsLinkLocalUnicast() { return i.bridgeIPv6 } return nil }
go
func getV6Network(config *networkConfiguration, i *bridgeInterface) *net.IPNet { if config.AddressIPv6 != nil { return config.AddressIPv6 } if i.bridgeIPv6 != nil && i.bridgeIPv6.IP != nil && !i.bridgeIPv6.IP.IsLinkLocalUnicast() { return i.bridgeIPv6 } return nil }
[ "func", "getV6Network", "(", "config", "*", "networkConfiguration", ",", "i", "*", "bridgeInterface", ")", "*", "net", ".", "IPNet", "{", "if", "config", ".", "AddressIPv6", "!=", "nil", "{", "return", "config", ".", "AddressIPv6", "\n", "}", "\n", "if", ...
// Returns the non link-local IPv6 subnet for the containers attached to this bridge if found, nil otherwise
[ "Returns", "the", "non", "link", "-", "local", "IPv6", "subnet", "for", "the", "containers", "attached", "to", "this", "bridge", "if", "found", "nil", "otherwise" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/bridge.go#L509-L518
22,465
docker/libnetwork
drivers/bridge/bridge.go
CreateNetwork
func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error { if len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0" { return types.BadRequestErrorf("ipv4 pool is empty") } // Sanity checks d.Lock() if _, ok := d....
go
func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error { if len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0" { return types.BadRequestErrorf("ipv4 pool is empty") } // Sanity checks d.Lock() if _, ok := d....
[ "func", "(", "d", "*", "driver", ")", "CreateNetwork", "(", "id", "string", ",", "option", "map", "[", "string", "]", "interface", "{", "}", ",", "nInfo", "driverapi", ".", "NetworkInfo", ",", "ipV4Data", ",", "ipV6Data", "[", "]", "driverapi", ".", "I...
// Create a new network using bridge plugin
[ "Create", "a", "new", "network", "using", "bridge", "plugin" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/bridge/bridge.go#L548-L592
22,466
docker/libnetwork
service.go
assignIPToEndpoint
func (s *service) assignIPToEndpoint(ip, eID string) (bool, int) { return s.ipToEndpoint.Insert(ip, eID) }
go
func (s *service) assignIPToEndpoint(ip, eID string) (bool, int) { return s.ipToEndpoint.Insert(ip, eID) }
[ "func", "(", "s", "*", "service", ")", "assignIPToEndpoint", "(", "ip", ",", "eID", "string", ")", "(", "bool", ",", "int", ")", "{", "return", "s", ".", "ipToEndpoint", ".", "Insert", "(", "ip", ",", "eID", ")", "\n", "}" ]
// assignIPToEndpoint inserts the mapping between the IP and the endpoint identifier // returns true if the mapping was not present, false otherwise // returns also the number of endpoints associated to the IP
[ "assignIPToEndpoint", "inserts", "the", "mapping", "between", "the", "IP", "and", "the", "endpoint", "identifier", "returns", "true", "if", "the", "mapping", "was", "not", "present", "false", "otherwise", "returns", "also", "the", "number", "of", "endpoints", "a...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service.go#L67-L69
22,467
docker/libnetwork
service.go
removeIPToEndpoint
func (s *service) removeIPToEndpoint(ip, eID string) (bool, int) { return s.ipToEndpoint.Remove(ip, eID) }
go
func (s *service) removeIPToEndpoint(ip, eID string) (bool, int) { return s.ipToEndpoint.Remove(ip, eID) }
[ "func", "(", "s", "*", "service", ")", "removeIPToEndpoint", "(", "ip", ",", "eID", "string", ")", "(", "bool", ",", "int", ")", "{", "return", "s", ".", "ipToEndpoint", ".", "Remove", "(", "ip", ",", "eID", ")", "\n", "}" ]
// removeIPToEndpoint removes the mapping between the IP and the endpoint identifier // returns true if the mapping was deleted, false otherwise // returns also the number of endpoints associated to the IP
[ "removeIPToEndpoint", "removes", "the", "mapping", "between", "the", "IP", "and", "the", "endpoint", "identifier", "returns", "true", "if", "the", "mapping", "was", "deleted", "false", "otherwise", "returns", "also", "the", "number", "of", "endpoints", "associated...
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/service.go#L74-L76
22,468
docker/libnetwork
controller.go
New
func New(cfgOptions ...config.Option) (NetworkController, error) { c := &controller{ id: stringid.GenerateRandomID(), cfg: config.ParseConfigOptions(cfgOptions...), sandboxes: sandboxTable{}, svcRecords: make(map[string]svcInfo), serviceBindings: make(map[serviceKey]*...
go
func New(cfgOptions ...config.Option) (NetworkController, error) { c := &controller{ id: stringid.GenerateRandomID(), cfg: config.ParseConfigOptions(cfgOptions...), sandboxes: sandboxTable{}, svcRecords: make(map[string]svcInfo), serviceBindings: make(map[serviceKey]*...
[ "func", "New", "(", "cfgOptions", "...", "config", ".", "Option", ")", "(", "NetworkController", ",", "error", ")", "{", "c", ":=", "&", "controller", "{", "id", ":", "stringid", ".", "GenerateRandomID", "(", ")", ",", "cfg", ":", "config", ".", "Parse...
// New creates a new instance of network controller.
[ "New", "creates", "a", "new", "instance", "of", "network", "controller", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L189-L256
22,469
docker/libnetwork
controller.go
SetKeys
func (c *controller) SetKeys(keys []*types.EncryptionKey) error { subsysKeys := make(map[string]int) for _, key := range keys { if key.Subsystem != subsysGossip && key.Subsystem != subsysIPSec { return fmt.Errorf("key received for unrecognized subsystem") } subsysKeys[key.Subsystem]++ } for s, count := ...
go
func (c *controller) SetKeys(keys []*types.EncryptionKey) error { subsysKeys := make(map[string]int) for _, key := range keys { if key.Subsystem != subsysGossip && key.Subsystem != subsysIPSec { return fmt.Errorf("key received for unrecognized subsystem") } subsysKeys[key.Subsystem]++ } for s, count := ...
[ "func", "(", "c", "*", "controller", ")", "SetKeys", "(", "keys", "[", "]", "*", "types", ".", "EncryptionKey", ")", "error", "{", "subsysKeys", ":=", "make", "(", "map", "[", "string", "]", "int", ")", "\n", "for", "_", ",", "key", ":=", "range", ...
// libnetwork side of agent depends on the keys. On the first receipt of // keys setup the agent. For subsequent key set handle the key change
[ "libnetwork", "side", "of", "agent", "depends", "on", "the", "keys", ".", "On", "the", "first", "receipt", "of", "keys", "setup", "the", "agent", ".", "For", "subsequent", "key", "set", "handle", "the", "key", "change" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L285-L309
22,470
docker/libnetwork
controller.go
AgentInitWait
func (c *controller) AgentInitWait() { c.Lock() agentInitDone := c.agentInitDone c.Unlock() if agentInitDone != nil { <-agentInitDone } }
go
func (c *controller) AgentInitWait() { c.Lock() agentInitDone := c.agentInitDone c.Unlock() if agentInitDone != nil { <-agentInitDone } }
[ "func", "(", "c", "*", "controller", ")", "AgentInitWait", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "agentInitDone", ":=", "c", ".", "agentInitDone", "\n", "c", ".", "Unlock", "(", ")", "\n\n", "if", "agentInitDone", "!=", "nil", "{", "<-", ...
// AgentInitWait waits for agent initialization to be completed in the controller.
[ "AgentInitWait", "waits", "for", "agent", "initialization", "to", "be", "completed", "in", "the", "controller", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L367-L375
22,471
docker/libnetwork
controller.go
AgentStopWait
func (c *controller) AgentStopWait() { c.Lock() agentStopDone := c.agentStopDone c.Unlock() if agentStopDone != nil { <-agentStopDone } }
go
func (c *controller) AgentStopWait() { c.Lock() agentStopDone := c.agentStopDone c.Unlock() if agentStopDone != nil { <-agentStopDone } }
[ "func", "(", "c", "*", "controller", ")", "AgentStopWait", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "agentStopDone", ":=", "c", ".", "agentStopDone", "\n", "c", ".", "Unlock", "(", ")", "\n", "if", "agentStopDone", "!=", "nil", "{", "<-", "...
// AgentStopWait waits for the Agent stop to be completed in the controller
[ "AgentStopWait", "waits", "for", "the", "Agent", "stop", "to", "be", "completed", "in", "the", "controller" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L378-L385
22,472
docker/libnetwork
controller.go
agentOperationStart
func (c *controller) agentOperationStart() { c.Lock() if c.agentInitDone == nil { c.agentInitDone = make(chan struct{}) } if c.agentStopDone == nil { c.agentStopDone = make(chan struct{}) } c.Unlock() }
go
func (c *controller) agentOperationStart() { c.Lock() if c.agentInitDone == nil { c.agentInitDone = make(chan struct{}) } if c.agentStopDone == nil { c.agentStopDone = make(chan struct{}) } c.Unlock() }
[ "func", "(", "c", "*", "controller", ")", "agentOperationStart", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "if", "c", ".", "agentInitDone", "==", "nil", "{", "c", ".", "agentInitDone", "=", "make", "(", "chan", "struct", "{", "}", ")", "\n",...
// agentOperationStart marks the start of an Agent Init or Agent Stop
[ "agentOperationStart", "marks", "the", "start", "of", "an", "Agent", "Init", "or", "Agent", "Stop" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L388-L397
22,473
docker/libnetwork
controller.go
agentInitComplete
func (c *controller) agentInitComplete() { c.Lock() if c.agentInitDone != nil { close(c.agentInitDone) c.agentInitDone = nil } c.Unlock() }
go
func (c *controller) agentInitComplete() { c.Lock() if c.agentInitDone != nil { close(c.agentInitDone) c.agentInitDone = nil } c.Unlock() }
[ "func", "(", "c", "*", "controller", ")", "agentInitComplete", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "if", "c", ".", "agentInitDone", "!=", "nil", "{", "close", "(", "c", ".", "agentInitDone", ")", "\n", "c", ".", "agentInitDone", "=", "...
// agentInitComplete notifies the successful completion of the Agent initialization
[ "agentInitComplete", "notifies", "the", "successful", "completion", "of", "the", "Agent", "initialization" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L400-L407
22,474
docker/libnetwork
controller.go
agentStopComplete
func (c *controller) agentStopComplete() { c.Lock() if c.agentStopDone != nil { close(c.agentStopDone) c.agentStopDone = nil } c.Unlock() }
go
func (c *controller) agentStopComplete() { c.Lock() if c.agentStopDone != nil { close(c.agentStopDone) c.agentStopDone = nil } c.Unlock() }
[ "func", "(", "c", "*", "controller", ")", "agentStopComplete", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "if", "c", ".", "agentStopDone", "!=", "nil", "{", "close", "(", "c", ".", "agentStopDone", ")", "\n", "c", ".", "agentStopDone", "=", "...
// agentStopComplete notifies the successful completion of the Agent stop
[ "agentStopComplete", "notifies", "the", "successful", "completion", "of", "the", "Agent", "stop" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L410-L417
22,475
docker/libnetwork
controller.go
SandboxDestroy
func (c *controller) SandboxDestroy(id string) error { var sb *sandbox c.Lock() for _, s := range c.sandboxes { if s.containerID == id { sb = s break } } c.Unlock() // It is not an error if sandbox is not available if sb == nil { return nil } return sb.Delete() }
go
func (c *controller) SandboxDestroy(id string) error { var sb *sandbox c.Lock() for _, s := range c.sandboxes { if s.containerID == id { sb = s break } } c.Unlock() // It is not an error if sandbox is not available if sb == nil { return nil } return sb.Delete() }
[ "func", "(", "c", "*", "controller", ")", "SandboxDestroy", "(", "id", "string", ")", "error", "{", "var", "sb", "*", "sandbox", "\n", "c", ".", "Lock", "(", ")", "\n", "for", "_", ",", "s", ":=", "range", "c", ".", "sandboxes", "{", "if", "s", ...
// SandboxDestroy destroys a sandbox given a container ID
[ "SandboxDestroy", "destroys", "a", "sandbox", "given", "a", "container", "ID" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1231-L1248
22,476
docker/libnetwork
controller.go
SandboxContainerWalker
func SandboxContainerWalker(out *Sandbox, containerID string) SandboxWalker { return func(sb Sandbox) bool { if sb.ContainerID() == containerID { *out = sb return true } return false } }
go
func SandboxContainerWalker(out *Sandbox, containerID string) SandboxWalker { return func(sb Sandbox) bool { if sb.ContainerID() == containerID { *out = sb return true } return false } }
[ "func", "SandboxContainerWalker", "(", "out", "*", "Sandbox", ",", "containerID", "string", ")", "SandboxWalker", "{", "return", "func", "(", "sb", "Sandbox", ")", "bool", "{", "if", "sb", ".", "ContainerID", "(", ")", "==", "containerID", "{", "*", "out",...
// SandboxContainerWalker returns a Sandbox Walker function which looks for an existing Sandbox with the passed containerID
[ "SandboxContainerWalker", "returns", "a", "Sandbox", "Walker", "function", "which", "looks", "for", "an", "existing", "Sandbox", "with", "the", "passed", "containerID" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1251-L1259
22,477
docker/libnetwork
controller.go
SandboxKeyWalker
func SandboxKeyWalker(out *Sandbox, key string) SandboxWalker { return func(sb Sandbox) bool { if sb.Key() == key { *out = sb return true } return false } }
go
func SandboxKeyWalker(out *Sandbox, key string) SandboxWalker { return func(sb Sandbox) bool { if sb.Key() == key { *out = sb return true } return false } }
[ "func", "SandboxKeyWalker", "(", "out", "*", "Sandbox", ",", "key", "string", ")", "SandboxWalker", "{", "return", "func", "(", "sb", "Sandbox", ")", "bool", "{", "if", "sb", ".", "Key", "(", ")", "==", "key", "{", "*", "out", "=", "sb", "\n", "ret...
// SandboxKeyWalker returns a Sandbox Walker function which looks for an existing Sandbox with the passed key
[ "SandboxKeyWalker", "returns", "a", "Sandbox", "Walker", "function", "which", "looks", "for", "an", "existing", "Sandbox", "with", "the", "passed", "key" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1262-L1270
22,478
docker/libnetwork
controller.go
StartDiagnostic
func (c *controller) StartDiagnostic(port int) { c.Lock() if !c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.EnableDiagnostic("127.0.0.1", port) } c.Unlock() }
go
func (c *controller) StartDiagnostic(port int) { c.Lock() if !c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.EnableDiagnostic("127.0.0.1", port) } c.Unlock() }
[ "func", "(", "c", "*", "controller", ")", "StartDiagnostic", "(", "port", "int", ")", "{", "c", ".", "Lock", "(", ")", "\n", "if", "!", "c", ".", "DiagnosticServer", ".", "IsDiagnosticEnabled", "(", ")", "{", "c", ".", "DiagnosticServer", ".", "EnableD...
// StartDiagnostic start the network dias mode
[ "StartDiagnostic", "start", "the", "network", "dias", "mode" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1335-L1341
22,479
docker/libnetwork
controller.go
StopDiagnostic
func (c *controller) StopDiagnostic() { c.Lock() if c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.DisableDiagnostic() } c.Unlock() }
go
func (c *controller) StopDiagnostic() { c.Lock() if c.DiagnosticServer.IsDiagnosticEnabled() { c.DiagnosticServer.DisableDiagnostic() } c.Unlock() }
[ "func", "(", "c", "*", "controller", ")", "StopDiagnostic", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "if", "c", ".", "DiagnosticServer", ".", "IsDiagnosticEnabled", "(", ")", "{", "c", ".", "DiagnosticServer", ".", "DisableDiagnostic", "(", ")", ...
// StopDiagnostic start the network dias mode
[ "StopDiagnostic", "start", "the", "network", "dias", "mode" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1344-L1350
22,480
docker/libnetwork
controller.go
IsDiagnosticEnabled
func (c *controller) IsDiagnosticEnabled() bool { c.Lock() defer c.Unlock() return c.DiagnosticServer.IsDiagnosticEnabled() }
go
func (c *controller) IsDiagnosticEnabled() bool { c.Lock() defer c.Unlock() return c.DiagnosticServer.IsDiagnosticEnabled() }
[ "func", "(", "c", "*", "controller", ")", "IsDiagnosticEnabled", "(", ")", "bool", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "DiagnosticServer", ".", "IsDiagnosticEnabled", "(", ")", "\n", ...
// IsDiagnosticEnabled returns true if the dias is enabled
[ "IsDiagnosticEnabled", "returns", "true", "if", "the", "dias", "is", "enabled" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/controller.go#L1353-L1357
22,481
docker/libnetwork
drivers/overlay/ov_network.go
destroySandbox
func (n *network) destroySandbox() { if n.sbox != nil { for _, iface := range n.sbox.Info().Interfaces() { if err := iface.Remove(); err != nil { logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err) } } for _, s := range n.subnets { if hostMode { if err := removeFilters(n.id[:1...
go
func (n *network) destroySandbox() { if n.sbox != nil { for _, iface := range n.sbox.Info().Interfaces() { if err := iface.Remove(); err != nil { logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err) } } for _, s := range n.subnets { if hostMode { if err := removeFilters(n.id[:1...
[ "func", "(", "n", "*", "network", ")", "destroySandbox", "(", ")", "{", "if", "n", ".", "sbox", "!=", "nil", "{", "for", "_", ",", "iface", ":=", "range", "n", ".", "sbox", ".", "Info", "(", ")", ".", "Interfaces", "(", ")", "{", "if", "err", ...
// to be called while holding network lock
[ "to", "be", "called", "while", "holding", "network", "lock" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/ov_network.go#L374-L412
22,482
docker/libnetwork
drivers/overlay/ov_network.go
initSubnetSandbox
func (n *network) initSubnetSandbox(s *subnet, restore bool) error { brName := n.generateBridgeName(s) vxlanName := n.generateVxlanName(s) if restore { if err := n.restoreSubnetSandbox(s, brName, vxlanName); err != nil { return err } } else { if err := n.setupSubnetSandbox(s, brName, vxlanName); err != ni...
go
func (n *network) initSubnetSandbox(s *subnet, restore bool) error { brName := n.generateBridgeName(s) vxlanName := n.generateVxlanName(s) if restore { if err := n.restoreSubnetSandbox(s, brName, vxlanName); err != nil { return err } } else { if err := n.setupSubnetSandbox(s, brName, vxlanName); err != ni...
[ "func", "(", "n", "*", "network", ")", "initSubnetSandbox", "(", "s", "*", "subnet", ",", "restore", "bool", ")", "error", "{", "brName", ":=", "n", ".", "generateBridgeName", "(", "s", ")", "\n", "vxlanName", ":=", "n", ".", "generateVxlanName", "(", ...
// Must be called with the network lock
[ "Must", "be", "called", "with", "the", "network", "lock" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/ov_network.go#L662-L680
22,483
docker/libnetwork
drivers/overlay/ov_network.go
restoreNetworkFromStore
func (d *driver) restoreNetworkFromStore(nid string) *network { n := d.getNetworkFromStore(nid) if n != nil { n.driver = d n.endpoints = endpointTable{} d.networks[nid] = n } return n }
go
func (d *driver) restoreNetworkFromStore(nid string) *network { n := d.getNetworkFromStore(nid) if n != nil { n.driver = d n.endpoints = endpointTable{} d.networks[nid] = n } return n }
[ "func", "(", "d", "*", "driver", ")", "restoreNetworkFromStore", "(", "nid", "string", ")", "*", "network", "{", "n", ":=", "d", ".", "getNetworkFromStore", "(", "nid", ")", "\n", "if", "n", "!=", "nil", "{", "n", ".", "driver", "=", "d", "\n", "n"...
// Restore a network from the store to the driver if it is present. // Must be called with the driver locked!
[ "Restore", "a", "network", "from", "the", "store", "to", "the", "driver", "if", "it", "is", "present", ".", "Must", "be", "called", "with", "the", "driver", "locked!" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/overlay/ov_network.go#L863-L871
22,484
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
createNetwork
func (d *driver) createNetwork(config *configuration) error { networkList := d.getNetworks() for _, nw := range networkList { if config.Parent == nw.config.Parent { return fmt.Errorf("network %s is already using parent interface %s", getDummyName(stringid.TruncateID(nw.config.ID)), config.Parent) } } if ...
go
func (d *driver) createNetwork(config *configuration) error { networkList := d.getNetworks() for _, nw := range networkList { if config.Parent == nw.config.Parent { return fmt.Errorf("network %s is already using parent interface %s", getDummyName(stringid.TruncateID(nw.config.ID)), config.Parent) } } if ...
[ "func", "(", "d", "*", "driver", ")", "createNetwork", "(", "config", "*", "configuration", ")", "error", "{", "networkList", ":=", "d", ".", "getNetworks", "(", ")", "\n", "for", "_", ",", "nw", ":=", "range", "networkList", "{", "if", "config", ".", ...
// createNetwork is used by new network callbacks and persistent network cache
[ "createNetwork", "is", "used", "by", "new", "network", "callbacks", "and", "persistent", "network", "cache" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L79-L121
22,485
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
DeleteNetwork
func (d *driver) DeleteNetwork(nid string) error { defer osl.InitOSContext()() n := d.network(nid) if n == nil { return fmt.Errorf("network id %s not found", nid) } // if the driver created the slave interface, delete it, otherwise leave it if ok := n.config.CreatedSlaveLink; ok { // if the interface exists, ...
go
func (d *driver) DeleteNetwork(nid string) error { defer osl.InitOSContext()() n := d.network(nid) if n == nil { return fmt.Errorf("network id %s not found", nid) } // if the driver created the slave interface, delete it, otherwise leave it if ok := n.config.CreatedSlaveLink; ok { // if the interface exists, ...
[ "func", "(", "d", "*", "driver", ")", "DeleteNetwork", "(", "nid", "string", ")", "error", "{", "defer", "osl", ".", "InitOSContext", "(", ")", "(", ")", "\n", "n", ":=", "d", ".", "network", "(", "nid", ")", "\n", "if", "n", "==", "nil", "{", ...
// DeleteNetwork the network for the specified driver type
[ "DeleteNetwork", "the", "network", "for", "the", "specified", "driver", "type" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L124-L170
22,486
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
parseNetworkOptions
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) { var ( err error config = &configuration{} ) // parse generic labels first if genData, ok := option[netlabel.GenericData]; ok && genData != nil { if config, err = parseNetworkGenericOptions(genData); err != nil { return...
go
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) { var ( err error config = &configuration{} ) // parse generic labels first if genData, ok := option[netlabel.GenericData]; ok && genData != nil { if config, err = parseNetworkGenericOptions(genData); err != nil { return...
[ "func", "parseNetworkOptions", "(", "id", "string", ",", "option", "options", ".", "Generic", ")", "(", "*", "configuration", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "config", "=", "&", "configuration", "{", "}", "\n", ")", "\n", "// ...
// parseNetworkOptions parse docker network options
[ "parseNetworkOptions", "parse", "docker", "network", "options" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L173-L191
22,487
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
parseNetworkGenericOptions
func parseNetworkGenericOptions(data interface{}) (*configuration, error) { var ( err error config *configuration ) switch opt := data.(type) { case *configuration: config = opt case map[string]string: config = &configuration{} err = config.fromOptions(opt) case options.Generic: var opaqueConfig in...
go
func parseNetworkGenericOptions(data interface{}) (*configuration, error) { var ( err error config *configuration ) switch opt := data.(type) { case *configuration: config = opt case map[string]string: config = &configuration{} err = config.fromOptions(opt) case options.Generic: var opaqueConfig in...
[ "func", "parseNetworkGenericOptions", "(", "data", "interface", "{", "}", ")", "(", "*", "configuration", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "config", "*", "configuration", "\n", ")", "\n", "switch", "opt", ":=", "data", ".", "(", ...
// parseNetworkGenericOptions parse generic driver docker network options
[ "parseNetworkGenericOptions", "parse", "generic", "driver", "docker", "network", "options" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L194-L214
22,488
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
fromOptions
func (config *configuration) fromOptions(labels map[string]string) error { for label, value := range labels { switch label { case parentOpt: // parse driver option '-o parent' config.Parent = value case driverModeOpt: // parse driver option '-o ipvlan_mode' config.IpvlanMode = value } } return ni...
go
func (config *configuration) fromOptions(labels map[string]string) error { for label, value := range labels { switch label { case parentOpt: // parse driver option '-o parent' config.Parent = value case driverModeOpt: // parse driver option '-o ipvlan_mode' config.IpvlanMode = value } } return ni...
[ "func", "(", "config", "*", "configuration", ")", "fromOptions", "(", "labels", "map", "[", "string", "]", "string", ")", "error", "{", "for", "label", ",", "value", ":=", "range", "labels", "{", "switch", "label", "{", "case", "parentOpt", ":", "// pars...
// fromOptions binds the generic options to networkConfiguration to cache
[ "fromOptions", "binds", "the", "generic", "options", "to", "networkConfiguration", "to", "cache" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L217-L229
22,489
docker/libnetwork
drivers/ipvlan/ipvlan_network.go
processIPAM
func (config *configuration) processIPAM(id string, ipamV4Data, ipamV6Data []driverapi.IPAMData) error { if len(ipamV4Data) > 0 { for _, ipd := range ipamV4Data { s := &ipv4Subnet{ SubnetIP: ipd.Pool.String(), GwIP: ipd.Gateway.String(), } config.Ipv4Subnets = append(config.Ipv4Subnets, s) } ...
go
func (config *configuration) processIPAM(id string, ipamV4Data, ipamV6Data []driverapi.IPAMData) error { if len(ipamV4Data) > 0 { for _, ipd := range ipamV4Data { s := &ipv4Subnet{ SubnetIP: ipd.Pool.String(), GwIP: ipd.Gateway.String(), } config.Ipv4Subnets = append(config.Ipv4Subnets, s) } ...
[ "func", "(", "config", "*", "configuration", ")", "processIPAM", "(", "id", "string", ",", "ipamV4Data", ",", "ipamV6Data", "[", "]", "driverapi", ".", "IPAMData", ")", "error", "{", "if", "len", "(", "ipamV4Data", ")", ">", "0", "{", "for", "_", ",", ...
// processIPAM parses v4 and v6 IP information and binds it to the network configuration
[ "processIPAM", "parses", "v4", "and", "v6", "IP", "information", "and", "binds", "it", "to", "the", "network", "configuration" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/drivers/ipvlan/ipvlan_network.go#L232-L252
22,490
docker/libnetwork
hostdiscovery/hostdiscovery.go
NewHostDiscovery
func NewHostDiscovery(watcher discovery.Watcher) HostDiscovery { return &hostDiscovery{watcher: watcher, nodes: mapset.NewSet(), stopChan: make(chan struct{})} }
go
func NewHostDiscovery(watcher discovery.Watcher) HostDiscovery { return &hostDiscovery{watcher: watcher, nodes: mapset.NewSet(), stopChan: make(chan struct{})} }
[ "func", "NewHostDiscovery", "(", "watcher", "discovery", ".", "Watcher", ")", "HostDiscovery", "{", "return", "&", "hostDiscovery", "{", "watcher", ":", "watcher", ",", "nodes", ":", "mapset", ".", "NewSet", "(", ")", ",", "stopChan", ":", "make", "(", "ch...
// NewHostDiscovery function creates a host discovery object
[ "NewHostDiscovery", "function", "creates", "a", "host", "discovery", "object" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/hostdiscovery/hostdiscovery.go#L33-L35
22,491
docker/libnetwork
driverapi/ipamdata.go
MarshalJSON
func (i *IPAMData) MarshalJSON() ([]byte, error) { m := map[string]interface{}{} m["AddressSpace"] = i.AddressSpace if i.Pool != nil { m["Pool"] = i.Pool.String() } if i.Gateway != nil { m["Gateway"] = i.Gateway.String() } if i.AuxAddresses != nil { am := make(map[string]string, len(i.AuxAddresses)) for ...
go
func (i *IPAMData) MarshalJSON() ([]byte, error) { m := map[string]interface{}{} m["AddressSpace"] = i.AddressSpace if i.Pool != nil { m["Pool"] = i.Pool.String() } if i.Gateway != nil { m["Gateway"] = i.Gateway.String() } if i.AuxAddresses != nil { am := make(map[string]string, len(i.AuxAddresses)) for ...
[ "func", "(", "i", "*", "IPAMData", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "m", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "m", "[", "\"", "\"", "]", "=", "i", ".", "AddressSpa...
// MarshalJSON encodes IPAMData into json message
[ "MarshalJSON", "encodes", "IPAMData", "into", "json", "message" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/driverapi/ipamdata.go#L12-L29
22,492
docker/libnetwork
driverapi/ipamdata.go
UnmarshalJSON
func (i *IPAMData) UnmarshalJSON(data []byte) error { var ( m map[string]interface{} err error ) if err := json.Unmarshal(data, &m); err != nil { return err } i.AddressSpace = m["AddressSpace"].(string) if v, ok := m["Pool"]; ok { if i.Pool, err = types.ParseCIDR(v.(string)); err != nil { return err ...
go
func (i *IPAMData) UnmarshalJSON(data []byte) error { var ( m map[string]interface{} err error ) if err := json.Unmarshal(data, &m); err != nil { return err } i.AddressSpace = m["AddressSpace"].(string) if v, ok := m["Pool"]; ok { if i.Pool, err = types.ParseCIDR(v.(string)); err != nil { return err ...
[ "func", "(", "i", "*", "IPAMData", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "var", "(", "m", "map", "[", "string", "]", "interface", "{", "}", "\n", "err", "error", "\n", ")", "\n", "if", "err", ":=", "json", ".", ...
// UnmarshalJSON decodes a json message into IPAMData
[ "UnmarshalJSON", "decodes", "a", "json", "message", "into", "IPAMData" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/driverapi/ipamdata.go#L32-L65
22,493
docker/libnetwork
driverapi/ipamdata.go
Validate
func (i *IPAMData) Validate() error { var isV6 bool if i.Pool == nil { return types.BadRequestErrorf("invalid pool") } if i.Gateway == nil { return types.BadRequestErrorf("invalid gateway address") } isV6 = i.IsV6() if isV6 && i.Gateway.IP.To4() != nil || !isV6 && i.Gateway.IP.To4() == nil { return types.B...
go
func (i *IPAMData) Validate() error { var isV6 bool if i.Pool == nil { return types.BadRequestErrorf("invalid pool") } if i.Gateway == nil { return types.BadRequestErrorf("invalid gateway address") } isV6 = i.IsV6() if isV6 && i.Gateway.IP.To4() != nil || !isV6 && i.Gateway.IP.To4() == nil { return types.B...
[ "func", "(", "i", "*", "IPAMData", ")", "Validate", "(", ")", "error", "{", "var", "isV6", "bool", "\n", "if", "i", ".", "Pool", "==", "nil", "{", "return", "types", ".", "BadRequestErrorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "i", ".", ...
// Validate checks whether the IPAMData structure contains congruent data
[ "Validate", "checks", "whether", "the", "IPAMData", "structure", "contains", "congruent", "data" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/driverapi/ipamdata.go#L68-L94
22,494
docker/libnetwork
default_gateway.go
clearDefaultGW
func (sb *sandbox) clearDefaultGW() error { var ep *endpoint if ep = sb.getEndpointInGWNetwork(); ep == nil { return nil } if err := ep.sbLeave(sb, false); err != nil { return fmt.Errorf("container %s: endpoint leaving GW Network failed: %v", sb.containerID, err) } if err := ep.Delete(false); err != nil { ...
go
func (sb *sandbox) clearDefaultGW() error { var ep *endpoint if ep = sb.getEndpointInGWNetwork(); ep == nil { return nil } if err := ep.sbLeave(sb, false); err != nil { return fmt.Errorf("container %s: endpoint leaving GW Network failed: %v", sb.containerID, err) } if err := ep.Delete(false); err != nil { ...
[ "func", "(", "sb", "*", "sandbox", ")", "clearDefaultGW", "(", ")", "error", "{", "var", "ep", "*", "endpoint", "\n\n", "if", "ep", "=", "sb", ".", "getEndpointInGWNetwork", "(", ")", ";", "ep", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "...
// If present, detach and remove the endpoint connecting the sandbox to the default gw network.
[ "If", "present", "detach", "and", "remove", "the", "endpoint", "connecting", "the", "sandbox", "to", "the", "default", "gw", "network", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L98-L111
22,495
docker/libnetwork
default_gateway.go
needDefaultGW
func (sb *sandbox) needDefaultGW() bool { var needGW bool for _, ep := range sb.getConnectedEndpoints() { if ep.endpointInGWNetwork() { continue } if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if ep.getNetwork().Internal() { continue } // During stale san...
go
func (sb *sandbox) needDefaultGW() bool { var needGW bool for _, ep := range sb.getConnectedEndpoints() { if ep.endpointInGWNetwork() { continue } if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if ep.getNetwork().Internal() { continue } // During stale san...
[ "func", "(", "sb", "*", "sandbox", ")", "needDefaultGW", "(", ")", "bool", "{", "var", "needGW", "bool", "\n\n", "for", "_", ",", "ep", ":=", "range", "sb", ".", "getConnectedEndpoints", "(", ")", "{", "if", "ep", ".", "endpointInGWNetwork", "(", ")", ...
// Evaluate whether the sandbox requires a default gateway based // on the endpoints to which it is connected. It does not account // for the default gateway network endpoint.
[ "Evaluate", "whether", "the", "sandbox", "requires", "a", "default", "gateway", "based", "on", "the", "endpoints", "to", "which", "it", "is", "connected", ".", "It", "does", "not", "account", "for", "the", "default", "gateway", "network", "endpoint", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L117-L147
22,496
docker/libnetwork
default_gateway.go
defaultGwNetwork
func (c *controller) defaultGwNetwork() (Network, error) { procGwNetwork <- true defer func() { <-procGwNetwork }() n, err := c.NetworkByName(libnGWNetwork) if _, ok := err.(types.NotFoundError); ok { n, err = c.createGWNetwork() } return n, err }
go
func (c *controller) defaultGwNetwork() (Network, error) { procGwNetwork <- true defer func() { <-procGwNetwork }() n, err := c.NetworkByName(libnGWNetwork) if _, ok := err.(types.NotFoundError); ok { n, err = c.createGWNetwork() } return n, err }
[ "func", "(", "c", "*", "controller", ")", "defaultGwNetwork", "(", ")", "(", "Network", ",", "error", ")", "{", "procGwNetwork", "<-", "true", "\n", "defer", "func", "(", ")", "{", "<-", "procGwNetwork", "}", "(", ")", "\n\n", "n", ",", "err", ":=", ...
// Looks for the default gw network and creates it if not there. // Parallel executions are serialized.
[ "Looks", "for", "the", "default", "gw", "network", "and", "creates", "it", "if", "not", "there", ".", "Parallel", "executions", "are", "serialized", "." ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L179-L188
22,497
docker/libnetwork
default_gateway.go
getGatewayEndpoint
func (sb *sandbox) getGatewayEndpoint() *endpoint { for _, ep := range sb.getConnectedEndpoints() { if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if len(ep.Gateway()) != 0 { return ep } } return nil }
go
func (sb *sandbox) getGatewayEndpoint() *endpoint { for _, ep := range sb.getConnectedEndpoints() { if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" { continue } if len(ep.Gateway()) != 0 { return ep } } return nil }
[ "func", "(", "sb", "*", "sandbox", ")", "getGatewayEndpoint", "(", ")", "*", "endpoint", "{", "for", "_", ",", "ep", ":=", "range", "sb", ".", "getConnectedEndpoints", "(", ")", "{", "if", "ep", ".", "getNetwork", "(", ")", ".", "Type", "(", ")", "...
// Returns the endpoint which is providing external connectivity to the sandbox
[ "Returns", "the", "endpoint", "which", "is", "providing", "external", "connectivity", "to", "the", "sandbox" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/default_gateway.go#L191-L201
22,498
docker/libnetwork
netutils/utils.go
CheckNameserverOverlaps
func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error { if len(nameservers) > 0 { for _, ns := range nameservers { _, nsNetwork, err := net.ParseCIDR(ns) if err != nil { return err } if NetworkOverlaps(toCheck, nsNetwork) { return ErrNetworkOverlapsWithNameservers } } ...
go
func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error { if len(nameservers) > 0 { for _, ns := range nameservers { _, nsNetwork, err := net.ParseCIDR(ns) if err != nil { return err } if NetworkOverlaps(toCheck, nsNetwork) { return ErrNetworkOverlapsWithNameservers } } ...
[ "func", "CheckNameserverOverlaps", "(", "nameservers", "[", "]", "string", ",", "toCheck", "*", "net", ".", "IPNet", ")", "error", "{", "if", "len", "(", "nameservers", ")", ">", "0", "{", "for", "_", ",", "ns", ":=", "range", "nameservers", "{", "_", ...
// CheckNameserverOverlaps checks whether the passed network overlaps with any of the nameservers
[ "CheckNameserverOverlaps", "checks", "whether", "the", "passed", "network", "overlaps", "with", "any", "of", "the", "nameservers" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L27-L40
22,499
docker/libnetwork
netutils/utils.go
NetworkOverlaps
func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool { return netX.Contains(netY.IP) || netY.Contains(netX.IP) }
go
func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool { return netX.Contains(netY.IP) || netY.Contains(netX.IP) }
[ "func", "NetworkOverlaps", "(", "netX", "*", "net", ".", "IPNet", ",", "netY", "*", "net", ".", "IPNet", ")", "bool", "{", "return", "netX", ".", "Contains", "(", "netY", ".", "IP", ")", "||", "netY", ".", "Contains", "(", "netX", ".", "IP", ")", ...
// NetworkOverlaps detects overlap between one IPNet and another
[ "NetworkOverlaps", "detects", "overlap", "between", "one", "IPNet", "and", "another" ]
9ff9b57c344df5cd47443ad9e65702ec85c5aeb0
https://github.com/docker/libnetwork/blob/9ff9b57c344df5cd47443ad9e65702ec85c5aeb0/netutils/utils.go#L43-L45