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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
163,100 | cilium/cilium | pkg/identity/identitymanager/manager.go | NewIdentityManager | func NewIdentityManager() *IdentityManager {
return &IdentityManager{
identities: make(map[identity.NumericIdentity]*identityMetadata),
observers: make(map[Observer]struct{}),
}
} | go | func NewIdentityManager() *IdentityManager {
return &IdentityManager{
identities: make(map[identity.NumericIdentity]*identityMetadata),
observers: make(map[Observer]struct{}),
}
} | [
"func",
"NewIdentityManager",
"(",
")",
"*",
"IdentityManager",
"{",
"return",
"&",
"IdentityManager",
"{",
"identities",
":",
"make",
"(",
"map",
"[",
"identity",
".",
"NumericIdentity",
"]",
"*",
"identityMetadata",
")",
",",
"observers",
":",
"make",
"(",
... | // NewIdentityManager returns an initialized IdentityManager. | [
"NewIdentityManager",
"returns",
"an",
"initialized",
"IdentityManager",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/identity/identitymanager/manager.go#L45-L50 |
163,101 | cilium/cilium | pkg/identity/identitymanager/manager.go | Add | func (idm *IdentityManager) Add(identity *identity.Identity) {
idm.mutex.Lock()
defer idm.mutex.Unlock()
idm.add(identity)
} | go | func (idm *IdentityManager) Add(identity *identity.Identity) {
idm.mutex.Lock()
defer idm.mutex.Unlock()
idm.add(identity)
} | [
"func",
"(",
"idm",
"*",
"IdentityManager",
")",
"Add",
"(",
"identity",
"*",
"identity",
".",
"Identity",
")",
"{",
"idm",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"idm",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"idm",
".",
"add",
... | // Add inserts the identity into the identity manager. If the identity is
// already in the identity manager, the reference count for the identity is
// incremented. | [
"Add",
"inserts",
"the",
"identity",
"into",
"the",
"identity",
"manager",
".",
"If",
"the",
"identity",
"is",
"already",
"in",
"the",
"identity",
"manager",
"the",
"reference",
"count",
"for",
"the",
"identity",
"is",
"incremented",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/identity/identitymanager/manager.go#L65-L69 |
163,102 | cilium/cilium | pkg/identity/identitymanager/manager.go | RemoveOldAddNew | func (idm *IdentityManager) RemoveOldAddNew(old, new *identity.Identity) {
idm.mutex.Lock()
defer idm.mutex.Unlock()
idm.remove(old)
idm.add(new)
} | go | func (idm *IdentityManager) RemoveOldAddNew(old, new *identity.Identity) {
idm.mutex.Lock()
defer idm.mutex.Unlock()
idm.remove(old)
idm.add(new)
} | [
"func",
"(",
"idm",
"*",
"IdentityManager",
")",
"RemoveOldAddNew",
"(",
"old",
",",
"new",
"*",
"identity",
".",
"Identity",
")",
"{",
"idm",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"idm",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
... | // RemoveOldAddNew removes old from the identity manager and inserts new
// into the IdentityManager. | [
"RemoveOldAddNew",
"removes",
"old",
"from",
"the",
"identity",
"manager",
"and",
"inserts",
"new",
"into",
"the",
"IdentityManager",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/identity/identitymanager/manager.go#L93-L99 |
163,103 | cilium/cilium | pkg/identity/identitymanager/manager.go | Remove | func (idm *IdentityManager) Remove(identity *identity.Identity) {
idm.mutex.Lock()
defer idm.mutex.Unlock()
idm.remove(identity)
} | go | func (idm *IdentityManager) Remove(identity *identity.Identity) {
idm.mutex.Lock()
defer idm.mutex.Unlock()
idm.remove(identity)
} | [
"func",
"(",
"idm",
"*",
"IdentityManager",
")",
"Remove",
"(",
"identity",
"*",
"identity",
".",
"Identity",
")",
"{",
"idm",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"idm",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"idm",
".",
"remo... | // Remove deletes the identity from the identity manager. If the identity is
// already in the identity manager, the reference count for the identity is
// decremented. If the identity is not in the cache, this is a no-op. If the
// ref count becomes zero, the identity is removed from the cache. | [
"Remove",
"deletes",
"the",
"identity",
"from",
"the",
"identity",
"manager",
".",
"If",
"the",
"identity",
"is",
"already",
"in",
"the",
"identity",
"manager",
"the",
"reference",
"count",
"for",
"the",
"identity",
"is",
"decremented",
".",
"If",
"the",
"id... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/identity/identitymanager/manager.go#L111-L115 |
163,104 | cilium/cilium | pkg/identity/identitymanager/manager.go | GetIdentityModels | func (idm *IdentityManager) GetIdentityModels() []*models.IdentityEndpoints {
idm.mutex.RLock()
defer idm.mutex.RUnlock()
identities := make([]*models.IdentityEndpoints, 0, len(idm.identities))
for _, v := range idm.identities {
identities = append(identities, &models.IdentityEndpoints{
Identity: v.identity.... | go | func (idm *IdentityManager) GetIdentityModels() []*models.IdentityEndpoints {
idm.mutex.RLock()
defer idm.mutex.RUnlock()
identities := make([]*models.IdentityEndpoints, 0, len(idm.identities))
for _, v := range idm.identities {
identities = append(identities, &models.IdentityEndpoints{
Identity: v.identity.... | [
"func",
"(",
"idm",
"*",
"IdentityManager",
")",
"GetIdentityModels",
"(",
")",
"[",
"]",
"*",
"models",
".",
"IdentityEndpoints",
"{",
"idm",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
"idm",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n\n",
... | // GetIdentityModels returns the API representation of the IdentityManager. | [
"GetIdentityModels",
"returns",
"the",
"API",
"representation",
"of",
"the",
"IdentityManager",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/identity/identitymanager/manager.go#L138-L152 |
163,105 | cilium/cilium | pkg/elf/elf.go | NewELF | func NewELF(ra io.ReaderAt, scopedLog *logrus.Entry) (*ELF, error) {
ef, err := elf.NewFile(ra)
if err != nil {
return nil, fmt.Errorf("unable to open ELF: %s", err)
}
// EM_NONE is generated by older Clang (eg 3.8.x), which we currently
// use in Travis. We should be able to drop that part pretty soon.
if ef.... | go | func NewELF(ra io.ReaderAt, scopedLog *logrus.Entry) (*ELF, error) {
ef, err := elf.NewFile(ra)
if err != nil {
return nil, fmt.Errorf("unable to open ELF: %s", err)
}
// EM_NONE is generated by older Clang (eg 3.8.x), which we currently
// use in Travis. We should be able to drop that part pretty soon.
if ef.... | [
"func",
"NewELF",
"(",
"ra",
"io",
".",
"ReaderAt",
",",
"scopedLog",
"*",
"logrus",
".",
"Entry",
")",
"(",
"*",
"ELF",
",",
"error",
")",
"{",
"ef",
",",
"err",
":=",
"elf",
".",
"NewFile",
"(",
"ra",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // NewELF returns a new object from the specified reader.
//
// The ELF binary is expected to start at position 0 in the specified reader. | [
"NewELF",
"returns",
"a",
"new",
"object",
"from",
"the",
"specified",
"reader",
".",
"The",
"ELF",
"binary",
"is",
"expected",
"to",
"start",
"at",
"position",
"0",
"in",
"the",
"specified",
"reader",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/elf/elf.go#L61-L82 |
163,106 | cilium/cilium | pkg/elf/elf.go | Open | func Open(path string) (*ELF, error) {
scopedLog := log.WithField(srcPath, path)
f, err := os.Open(path)
if err != nil {
return nil, &os.PathError{
Op: "failed to open ELF file",
Path: path,
Err: err,
}
}
result, err := NewELF(f, scopedLog)
if err != nil {
if err2 := f.Close(); err2 != nil {
... | go | func Open(path string) (*ELF, error) {
scopedLog := log.WithField(srcPath, path)
f, err := os.Open(path)
if err != nil {
return nil, &os.PathError{
Op: "failed to open ELF file",
Path: path,
Err: err,
}
}
result, err := NewELF(f, scopedLog)
if err != nil {
if err2 := f.Close(); err2 != nil {
... | [
"func",
"Open",
"(",
"path",
"string",
")",
"(",
"*",
"ELF",
",",
"error",
")",
"{",
"scopedLog",
":=",
"log",
".",
"WithField",
"(",
"srcPath",
",",
"path",
")",
"\n\n",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"... | // Open an ELF file from the specified path. | [
"Open",
"an",
"ELF",
"file",
"from",
"the",
"specified",
"path",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/elf/elf.go#L85-L110 |
163,107 | cilium/cilium | pkg/elf/elf.go | Close | func (elf *ELF) Close() (err error) {
if elf.file != nil {
err = elf.file.Close()
}
return err
} | go | func (elf *ELF) Close() (err error) {
if elf.file != nil {
err = elf.file.Close()
}
return err
} | [
"func",
"(",
"elf",
"*",
"ELF",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"elf",
".",
"file",
"!=",
"nil",
"{",
"err",
"=",
"elf",
".",
"file",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] | // Close closes the ELF. If the File was created using NewELF directly instead
// of Open, Close has no effect. | [
"Close",
"closes",
"the",
"ELF",
".",
"If",
"the",
"File",
"was",
"created",
"using",
"NewELF",
"directly",
"instead",
"of",
"Open",
"Close",
"has",
"no",
"effect",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/elf/elf.go#L114-L119 |
163,108 | cilium/cilium | pkg/k8s/apis/cilium.io/v2/register.go | CreateCustomResourceDefinitions | func CreateCustomResourceDefinitions(clientset apiextensionsclient.Interface) error {
if err := createCNPCRD(clientset); err != nil {
return err
}
if err := createCEPCRD(clientset); err != nil {
return err
}
return nil
} | go | func CreateCustomResourceDefinitions(clientset apiextensionsclient.Interface) error {
if err := createCNPCRD(clientset); err != nil {
return err
}
if err := createCEPCRD(clientset); err != nil {
return err
}
return nil
} | [
"func",
"CreateCustomResourceDefinitions",
"(",
"clientset",
"apiextensionsclient",
".",
"Interface",
")",
"error",
"{",
"if",
"err",
":=",
"createCNPCRD",
"(",
"clientset",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
... | // CreateCustomResourceDefinitions creates our CRD objects in the kubernetes
// cluster | [
"CreateCustomResourceDefinitions",
"creates",
"our",
"CRD",
"objects",
"in",
"the",
"kubernetes",
"cluster"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/k8s/apis/cilium.io/v2/register.go#L113-L123 |
163,109 | cilium/cilium | pkg/k8s/apis/cilium.io/v2/register.go | createCNPCRD | func createCNPCRD(clientset apiextensionsclient.Interface) error {
var (
// CustomResourceDefinitionSingularName is the singular name of custom resource definition
CustomResourceDefinitionSingularName = "ciliumnetworkpolicy"
// CustomResourceDefinitionPluralName is the plural name of custom resource definition
... | go | func createCNPCRD(clientset apiextensionsclient.Interface) error {
var (
// CustomResourceDefinitionSingularName is the singular name of custom resource definition
CustomResourceDefinitionSingularName = "ciliumnetworkpolicy"
// CustomResourceDefinitionPluralName is the plural name of custom resource definition
... | [
"func",
"createCNPCRD",
"(",
"clientset",
"apiextensionsclient",
".",
"Interface",
")",
"error",
"{",
"var",
"(",
"// CustomResourceDefinitionSingularName is the singular name of custom resource definition",
"CustomResourceDefinitionSingularName",
"=",
"\"",
"\"",
"\n\n",
"// Cus... | // createCNPCRD creates and updates the CiliumNetworkPolicies CRD. It should be called
// on agent startup but is idempotent and safe to call again. | [
"createCNPCRD",
"creates",
"and",
"updates",
"the",
"CiliumNetworkPolicies",
"CRD",
".",
"It",
"should",
"be",
"called",
"on",
"agent",
"startup",
"but",
"is",
"idempotent",
"and",
"safe",
"to",
"call",
"again",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/k8s/apis/cilium.io/v2/register.go#L127-L169 |
163,110 | cilium/cilium | pkg/k8s/apis/cilium.io/v2/register.go | createCEPCRD | func createCEPCRD(clientset apiextensionsclient.Interface) error {
var (
// CustomResourceDefinitionSingularName is the singular name of custom resource definition
CustomResourceDefinitionSingularName = "ciliumendpoint"
// CustomResourceDefinitionPluralName is the plural name of custom resource definition
Cus... | go | func createCEPCRD(clientset apiextensionsclient.Interface) error {
var (
// CustomResourceDefinitionSingularName is the singular name of custom resource definition
CustomResourceDefinitionSingularName = "ciliumendpoint"
// CustomResourceDefinitionPluralName is the plural name of custom resource definition
Cus... | [
"func",
"createCEPCRD",
"(",
"clientset",
"apiextensionsclient",
".",
"Interface",
")",
"error",
"{",
"var",
"(",
"// CustomResourceDefinitionSingularName is the singular name of custom resource definition",
"CustomResourceDefinitionSingularName",
"=",
"\"",
"\"",
"\n\n",
"// Cus... | // createCEPCRD creates and updates the CiliumEndpoint CRD. It should be called
// on agent startup but is idempotent and safe to call again. | [
"createCEPCRD",
"creates",
"and",
"updates",
"the",
"CiliumEndpoint",
"CRD",
".",
"It",
"should",
"be",
"called",
"on",
"agent",
"startup",
"but",
"is",
"idempotent",
"and",
"safe",
"to",
"call",
"again",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/k8s/apis/cilium.io/v2/register.go#L173-L256 |
163,111 | cilium/cilium | pkg/endpoint/endpoint.go | UpdateController | func (e *Endpoint) UpdateController(name string, params controller.ControllerParams) *controller.Controller {
return e.controllers.UpdateController(name, params)
} | go | func (e *Endpoint) UpdateController(name string, params controller.ControllerParams) *controller.Controller {
return e.controllers.UpdateController(name, params)
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"UpdateController",
"(",
"name",
"string",
",",
"params",
"controller",
".",
"ControllerParams",
")",
"*",
"controller",
".",
"Controller",
"{",
"return",
"e",
".",
"controllers",
".",
"UpdateController",
"(",
"name",
... | // UpdateController updates the controller with the specified name with the
// provided list of parameters in endpoint's list of controllers. | [
"UpdateController",
"updates",
"the",
"controller",
"with",
"the",
"specified",
"name",
"with",
"the",
"provided",
"list",
"of",
"parameters",
"in",
"endpoint",
"s",
"list",
"of",
"controllers",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L315-L317 |
163,112 | cilium/cilium | pkg/endpoint/endpoint.go | SetDesiredIngressPolicyEnabled | func (e *Endpoint) SetDesiredIngressPolicyEnabled(ingress bool) {
e.UnconditionalLock()
e.desiredPolicy.IngressPolicyEnabled = ingress
e.Unlock()
} | go | func (e *Endpoint) SetDesiredIngressPolicyEnabled(ingress bool) {
e.UnconditionalLock()
e.desiredPolicy.IngressPolicyEnabled = ingress
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetDesiredIngressPolicyEnabled",
"(",
"ingress",
"bool",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"desiredPolicy",
".",
"IngressPolicyEnabled",
"=",
"ingress",
"\n",
"e",
".",
"Unlock",
"(",
... | // SetDesiredIngressPolicyEnabled sets Endpoint's ingress policy enforcement
// configuration to the specified value. The endpoint's mutex must not be held. | [
"SetDesiredIngressPolicyEnabled",
"sets",
"Endpoint",
"s",
"ingress",
"policy",
"enforcement",
"configuration",
"to",
"the",
"specified",
"value",
".",
"The",
"endpoint",
"s",
"mutex",
"must",
"not",
"be",
"held",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L363-L368 |
163,113 | cilium/cilium | pkg/endpoint/endpoint.go | SetDesiredEgressPolicyEnabled | func (e *Endpoint) SetDesiredEgressPolicyEnabled(egress bool) {
e.UnconditionalLock()
e.desiredPolicy.EgressPolicyEnabled = egress
e.Unlock()
} | go | func (e *Endpoint) SetDesiredEgressPolicyEnabled(egress bool) {
e.UnconditionalLock()
e.desiredPolicy.EgressPolicyEnabled = egress
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetDesiredEgressPolicyEnabled",
"(",
"egress",
"bool",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"desiredPolicy",
".",
"EgressPolicyEnabled",
"=",
"egress",
"\n",
"e",
".",
"Unlock",
"(",
")... | // SetDesiredEgressPolicyEnabled sets Endpoint's egress policy enforcement
// configuration to the specified value. The endpoint's mutex must not be held. | [
"SetDesiredEgressPolicyEnabled",
"sets",
"Endpoint",
"s",
"egress",
"policy",
"enforcement",
"configuration",
"to",
"the",
"specified",
"value",
".",
"The",
"endpoint",
"s",
"mutex",
"must",
"not",
"be",
"held",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L372-L376 |
163,114 | cilium/cilium | pkg/endpoint/endpoint.go | WaitForProxyCompletions | func (e *Endpoint) WaitForProxyCompletions(proxyWaitGroup *completion.WaitGroup) error {
if proxyWaitGroup == nil {
return nil
}
err := proxyWaitGroup.Context().Err()
if err != nil {
return fmt.Errorf("context cancelled before waiting for proxy updates: %s", err)
}
start := time.Now()
e.getLogger().Debug(... | go | func (e *Endpoint) WaitForProxyCompletions(proxyWaitGroup *completion.WaitGroup) error {
if proxyWaitGroup == nil {
return nil
}
err := proxyWaitGroup.Context().Err()
if err != nil {
return fmt.Errorf("context cancelled before waiting for proxy updates: %s", err)
}
start := time.Now()
e.getLogger().Debug(... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"WaitForProxyCompletions",
"(",
"proxyWaitGroup",
"*",
"completion",
".",
"WaitGroup",
")",
"error",
"{",
"if",
"proxyWaitGroup",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"err",
":=",
"proxyWaitGroup",
"."... | // WaitForProxyCompletions blocks until all proxy changes have been completed.
// Called with BuildMutex held. | [
"WaitForProxyCompletions",
"blocks",
"until",
"all",
"proxy",
"changes",
"have",
"been",
"completed",
".",
"Called",
"with",
"BuildMutex",
"held",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L392-L412 |
163,115 | cilium/cilium | pkg/endpoint/endpoint.go | NewEndpointWithState | func NewEndpointWithState(ID uint16, state string) *Endpoint {
ep := &Endpoint{
ID: ID,
OpLabels: pkgLabels.NewOpLabels(),
Status: NewEndpointStatus(),
DNSHistory: fqdn.NewDNSCacheWithLimit(option.Config.ToFQDNsMinTTL, option.Config.ToFQDNsMaxIPsPerHost),
state: state,
... | go | func NewEndpointWithState(ID uint16, state string) *Endpoint {
ep := &Endpoint{
ID: ID,
OpLabels: pkgLabels.NewOpLabels(),
Status: NewEndpointStatus(),
DNSHistory: fqdn.NewDNSCacheWithLimit(option.Config.ToFQDNsMinTTL, option.Config.ToFQDNsMaxIPsPerHost),
state: state,
... | [
"func",
"NewEndpointWithState",
"(",
"ID",
"uint16",
",",
"state",
"string",
")",
"*",
"Endpoint",
"{",
"ep",
":=",
"&",
"Endpoint",
"{",
"ID",
":",
"ID",
",",
"OpLabels",
":",
"pkgLabels",
".",
"NewOpLabels",
"(",
")",
",",
"Status",
":",
"NewEndpointSt... | // NewEndpointWithState creates a new endpoint useful for testing purposes | [
"NewEndpointWithState",
"creates",
"a",
"new",
"endpoint",
"useful",
"for",
"testing",
"purposes"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L415-L434 |
163,116 | cilium/cilium | pkg/endpoint/endpoint.go | NewEndpointFromChangeModel | func NewEndpointFromChangeModel(base *models.EndpointChangeRequest) (*Endpoint, error) {
if base == nil {
return nil, nil
}
ep := &Endpoint{
ID: uint16(base.ID),
ContainerName: base.ContainerName,
ContainerID: base.ContainerID,
DockerNetworkID: base.DockerNetworkID,
DockerEndpoint... | go | func NewEndpointFromChangeModel(base *models.EndpointChangeRequest) (*Endpoint, error) {
if base == nil {
return nil, nil
}
ep := &Endpoint{
ID: uint16(base.ID),
ContainerName: base.ContainerName,
ContainerID: base.ContainerID,
DockerNetworkID: base.DockerNetworkID,
DockerEndpoint... | [
"func",
"NewEndpointFromChangeModel",
"(",
"base",
"*",
"models",
".",
"EndpointChangeRequest",
")",
"(",
"*",
"Endpoint",
",",
"error",
")",
"{",
"if",
"base",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"ep",
":=",
"&",
"Endpoint"... | // NewEndpointFromChangeModel creates a new endpoint from a request | [
"NewEndpointFromChangeModel",
"creates",
"a",
"new",
"endpoint",
"from",
"a",
"request"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L437-L503 |
163,117 | cilium/cilium | pkg/endpoint/endpoint.go | GetModelRLocked | func (e *Endpoint) GetModelRLocked() *models.Endpoint {
if e == nil {
return nil
}
currentState := models.EndpointState(e.state)
if currentState == models.EndpointStateReady && e.Status.CurrentStatus() != OK {
currentState = models.EndpointStateNotReady
}
// This returns the most recent log entry for this e... | go | func (e *Endpoint) GetModelRLocked() *models.Endpoint {
if e == nil {
return nil
}
currentState := models.EndpointState(e.state)
if currentState == models.EndpointStateReady && e.Status.CurrentStatus() != OK {
currentState = models.EndpointStateNotReady
}
// This returns the most recent log entry for this e... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetModelRLocked",
"(",
")",
"*",
"models",
".",
"Endpoint",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"currentState",
":=",
"models",
".",
"EndpointState",
"(",
"e",
".",
"state",
"... | // GetModelRLocked returns the API model of endpoint e.
// e.mutex must be RLocked. | [
"GetModelRLocked",
"returns",
"the",
"API",
"model",
"of",
"endpoint",
"e",
".",
"e",
".",
"mutex",
"must",
"be",
"RLocked",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L507-L582 |
163,118 | cilium/cilium | pkg/endpoint/endpoint.go | getHealthModel | func (e *Endpoint) getHealthModel() *models.EndpointHealth {
// Duplicated from GetModelRLocked.
currentState := models.EndpointState(e.state)
if currentState == models.EndpointStateReady && e.Status.CurrentStatus() != OK {
currentState = models.EndpointStateNotReady
}
h := models.EndpointHealth{
Bpf: ... | go | func (e *Endpoint) getHealthModel() *models.EndpointHealth {
// Duplicated from GetModelRLocked.
currentState := models.EndpointState(e.state)
if currentState == models.EndpointStateReady && e.Status.CurrentStatus() != OK {
currentState = models.EndpointStateNotReady
}
h := models.EndpointHealth{
Bpf: ... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"getHealthModel",
"(",
")",
"*",
"models",
".",
"EndpointHealth",
"{",
"// Duplicated from GetModelRLocked.",
"currentState",
":=",
"models",
".",
"EndpointState",
"(",
"e",
".",
"state",
")",
"\n",
"if",
"currentState",
... | // GetHealthModel returns the endpoint's health object.
//
// Must be called with e.Mutex locked. | [
"GetHealthModel",
"returns",
"the",
"endpoint",
"s",
"health",
"object",
".",
"Must",
"be",
"called",
"with",
"e",
".",
"Mutex",
"locked",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L587-L646 |
163,119 | cilium/cilium | pkg/endpoint/endpoint.go | GetHealthModel | func (e *Endpoint) GetHealthModel() *models.EndpointHealth {
// NOTE: Using rlock on mutex directly because getHealthModel handles removed endpoint properly
e.mutex.RLock()
defer e.mutex.RUnlock()
return e.getHealthModel()
} | go | func (e *Endpoint) GetHealthModel() *models.EndpointHealth {
// NOTE: Using rlock on mutex directly because getHealthModel handles removed endpoint properly
e.mutex.RLock()
defer e.mutex.RUnlock()
return e.getHealthModel()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetHealthModel",
"(",
")",
"*",
"models",
".",
"EndpointHealth",
"{",
"// NOTE: Using rlock on mutex directly because getHealthModel handles removed endpoint properly",
"e",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
... | // GetHealthModel returns the endpoint's health object. | [
"GetHealthModel",
"returns",
"the",
"endpoint",
"s",
"health",
"object",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L649-L654 |
163,120 | cilium/cilium | pkg/endpoint/endpoint.go | GetModel | func (e *Endpoint) GetModel() *models.Endpoint {
if e == nil {
return nil
}
// NOTE: Using rlock on mutex directly because GetModelRLocked handles removed endpoint properly
e.mutex.RLock()
defer e.mutex.RUnlock()
return e.GetModelRLocked()
} | go | func (e *Endpoint) GetModel() *models.Endpoint {
if e == nil {
return nil
}
// NOTE: Using rlock on mutex directly because GetModelRLocked handles removed endpoint properly
e.mutex.RLock()
defer e.mutex.RUnlock()
return e.GetModelRLocked()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetModel",
"(",
")",
"*",
"models",
".",
"Endpoint",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"// NOTE: Using rlock on mutex directly because GetModelRLocked handles removed endpoint properly",
"e",... | // GetModel returns the API model of endpoint e. | [
"GetModel",
"returns",
"the",
"API",
"model",
"of",
"endpoint",
"e",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L657-L666 |
163,121 | cilium/cilium | pkg/endpoint/endpoint.go | policyStatus | func (e *Endpoint) policyStatus() models.EndpointPolicyEnabled {
policyEnabled := models.EndpointPolicyEnabledNone
switch {
case e.realizedPolicy.IngressPolicyEnabled && e.realizedPolicy.EgressPolicyEnabled:
policyEnabled = models.EndpointPolicyEnabledBoth
case e.realizedPolicy.IngressPolicyEnabled:
policyEnabl... | go | func (e *Endpoint) policyStatus() models.EndpointPolicyEnabled {
policyEnabled := models.EndpointPolicyEnabledNone
switch {
case e.realizedPolicy.IngressPolicyEnabled && e.realizedPolicy.EgressPolicyEnabled:
policyEnabled = models.EndpointPolicyEnabledBoth
case e.realizedPolicy.IngressPolicyEnabled:
policyEnabl... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"policyStatus",
"(",
")",
"models",
".",
"EndpointPolicyEnabled",
"{",
"policyEnabled",
":=",
"models",
".",
"EndpointPolicyEnabledNone",
"\n",
"switch",
"{",
"case",
"e",
".",
"realizedPolicy",
".",
"IngressPolicyEnabled",
... | // policyStatus returns the endpoint's policy status
//
// Must be called with e.Mutex locked. | [
"policyStatus",
"returns",
"the",
"endpoint",
"s",
"policy",
"status",
"Must",
"be",
"called",
"with",
"e",
".",
"Mutex",
"locked",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L791-L802 |
163,122 | cilium/cilium | pkg/endpoint/endpoint.go | GetLabels | func (e *Endpoint) GetLabels() []string {
if e.SecurityIdentity == nil {
return []string{}
}
return e.SecurityIdentity.Labels.GetModel()
} | go | func (e *Endpoint) GetLabels() []string {
if e.SecurityIdentity == nil {
return []string{}
}
return e.SecurityIdentity.Labels.GetModel()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetLabels",
"(",
")",
"[",
"]",
"string",
"{",
"if",
"e",
".",
"SecurityIdentity",
"==",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n\n",
"return",
"e",
".",
"SecurityIdentity",
".",
"L... | // GetLabels returns the labels as slice | [
"GetLabels",
"returns",
"the",
"labels",
"as",
"slice"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L810-L816 |
163,123 | cilium/cilium | pkg/endpoint/endpoint.go | GetK8sPodLabels | func (e *Endpoint) GetK8sPodLabels() pkgLabels.Labels {
e.UnconditionalRLock()
defer e.RUnlock()
allLabels := e.OpLabels.AllLabels()
if allLabels == nil {
return nil
}
allLabelsFromK8s := allLabels.GetFromSource(pkgLabels.LabelSourceK8s)
k8sEPPodLabels := pkgLabels.Labels{}
for k, v := range allLabelsFromK8... | go | func (e *Endpoint) GetK8sPodLabels() pkgLabels.Labels {
e.UnconditionalRLock()
defer e.RUnlock()
allLabels := e.OpLabels.AllLabels()
if allLabels == nil {
return nil
}
allLabelsFromK8s := allLabels.GetFromSource(pkgLabels.LabelSourceK8s)
k8sEPPodLabels := pkgLabels.Labels{}
for k, v := range allLabelsFromK8... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetK8sPodLabels",
"(",
")",
"pkgLabels",
".",
"Labels",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"defer",
"e",
".",
"RUnlock",
"(",
")",
"\n",
"allLabels",
":=",
"e",
".",
"OpLabels",
".",
"AllLabels... | // GetK8sPodLabels returns all labels that exist in the endpoint and were
// derived from k8s pod. | [
"GetK8sPodLabels",
"returns",
"all",
"labels",
"that",
"exist",
"in",
"the",
"endpoint",
"and",
"were",
"derived",
"from",
"k8s",
"pod",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L831-L850 |
163,124 | cilium/cilium | pkg/endpoint/endpoint.go | GetLabelsSHA | func (e *Endpoint) GetLabelsSHA() string {
if e.SecurityIdentity == nil {
return ""
}
return e.SecurityIdentity.GetLabelsSHA256()
} | go | func (e *Endpoint) GetLabelsSHA() string {
if e.SecurityIdentity == nil {
return ""
}
return e.SecurityIdentity.GetLabelsSHA256()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetLabelsSHA",
"(",
")",
"string",
"{",
"if",
"e",
".",
"SecurityIdentity",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"e",
".",
"SecurityIdentity",
".",
"GetLabelsSHA256",
"(",
")",
"\... | // GetLabelsSHA returns the SHA of labels | [
"GetLabelsSHA",
"returns",
"the",
"SHA",
"of",
"labels"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L853-L859 |
163,125 | cilium/cilium | pkg/endpoint/endpoint.go | GetOpLabels | func (e *Endpoint) GetOpLabels() []string {
e.UnconditionalRLock()
defer e.RUnlock()
return e.OpLabels.IdentityLabels().GetModel()
} | go | func (e *Endpoint) GetOpLabels() []string {
e.UnconditionalRLock()
defer e.RUnlock()
return e.OpLabels.IdentityLabels().GetModel()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetOpLabels",
"(",
")",
"[",
"]",
"string",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"defer",
"e",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"e",
".",
"OpLabels",
".",
"IdentityLabels",
"(",
")",
... | // GetOpLabels returns the labels as slice | [
"GetOpLabels",
"returns",
"the",
"labels",
"as",
"slice"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L862-L866 |
163,126 | cilium/cilium | pkg/endpoint/endpoint.go | ConntrackName | func (e *Endpoint) ConntrackName() string {
if e.ConntrackLocalLocked() {
return fmt.Sprintf("%05d", int(e.ID))
}
return "global"
} | go | func (e *Endpoint) ConntrackName() string {
if e.ConntrackLocalLocked() {
return fmt.Sprintf("%05d", int(e.ID))
}
return "global"
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"ConntrackName",
"(",
")",
"string",
"{",
"if",
"e",
".",
"ConntrackLocalLocked",
"(",
")",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"int",
"(",
"e",
".",
"ID",
")",
")",
"\n",
"}",
"\n",... | // ConntrackName returns the name suffix for the endpoint-specific bpf
// conntrack map, which is a 5-digit endpoint ID, or "global" when the
// global map should be used.
// Must be called with the endpoint locked. | [
"ConntrackName",
"returns",
"the",
"name",
"suffix",
"for",
"the",
"endpoint",
"-",
"specific",
"bpf",
"conntrack",
"map",
"which",
"is",
"a",
"5",
"-",
"digit",
"endpoint",
"ID",
"or",
"global",
"when",
"the",
"global",
"map",
"should",
"be",
"used",
".",... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L911-L916 |
163,127 | cilium/cilium | pkg/endpoint/endpoint.go | String | func (e *Endpoint) String() string {
e.UnconditionalRLock()
defer e.RUnlock()
b, err := json.MarshalIndent(e, "", " ")
if err != nil {
return err.Error()
}
return string(b)
} | go | func (e *Endpoint) String() string {
e.UnconditionalRLock()
defer e.RUnlock()
b, err := json.MarshalIndent(e, "", " ")
if err != nil {
return err.Error()
}
return string(b)
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"String",
"(",
")",
"string",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"defer",
"e",
".",
"RUnlock",
"(",
")",
"\n",
"b",
",",
"err",
":=",
"json",
".",
"MarshalIndent",
"(",
"e",
",",
"\"",
"\"... | // String returns endpoint on a JSON format. | [
"String",
"returns",
"endpoint",
"on",
"a",
"JSON",
"format",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L945-L953 |
163,128 | cilium/cilium | pkg/endpoint/endpoint.go | applyOptsLocked | func (e *Endpoint) applyOptsLocked(opts option.OptionMap) bool {
changed := e.Options.ApplyValidated(opts, optionChanged, e) > 0
_, exists := opts[option.Debug]
if exists && changed {
e.UpdateLogger(nil)
}
return changed
} | go | func (e *Endpoint) applyOptsLocked(opts option.OptionMap) bool {
changed := e.Options.ApplyValidated(opts, optionChanged, e) > 0
_, exists := opts[option.Debug]
if exists && changed {
e.UpdateLogger(nil)
}
return changed
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"applyOptsLocked",
"(",
"opts",
"option",
".",
"OptionMap",
")",
"bool",
"{",
"changed",
":=",
"e",
".",
"Options",
".",
"ApplyValidated",
"(",
"opts",
",",
"optionChanged",
",",
"e",
")",
">",
"0",
"\n",
"_",
... | // applyOptsLocked applies the given options to the endpoint's options and
// returns true if there were any options changed. | [
"applyOptsLocked",
"applies",
"the",
"given",
"options",
"to",
"the",
"endpoint",
"s",
"options",
"and",
"returns",
"true",
"if",
"there",
"were",
"any",
"options",
"changed",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L962-L969 |
163,129 | cilium/cilium | pkg/endpoint/endpoint.go | SetDefaultOpts | func (e *Endpoint) SetDefaultOpts(opts *option.IntOptions) {
if e.Options == nil {
e.Options = option.NewIntOptions(&EndpointMutableOptionLibrary)
}
if e.Options.Library == nil {
e.Options.Library = &EndpointMutableOptionLibrary
}
if opts != nil {
epOptLib := option.GetEndpointMutableOptionLibrary()
for k... | go | func (e *Endpoint) SetDefaultOpts(opts *option.IntOptions) {
if e.Options == nil {
e.Options = option.NewIntOptions(&EndpointMutableOptionLibrary)
}
if e.Options.Library == nil {
e.Options.Library = &EndpointMutableOptionLibrary
}
if opts != nil {
epOptLib := option.GetEndpointMutableOptionLibrary()
for k... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetDefaultOpts",
"(",
"opts",
"*",
"option",
".",
"IntOptions",
")",
"{",
"if",
"e",
".",
"Options",
"==",
"nil",
"{",
"e",
".",
"Options",
"=",
"option",
".",
"NewIntOptions",
"(",
"&",
"EndpointMutableOptionLibr... | // SetDefaultOpts initializes the endpoint Options and configures the specified
// options. | [
"SetDefaultOpts",
"initializes",
"the",
"endpoint",
"Options",
"and",
"configures",
"the",
"specified",
"options",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L978-L993 |
163,130 | cilium/cilium | pkg/endpoint/endpoint.go | ConntrackLocalLocked | func (e *Endpoint) ConntrackLocalLocked() bool {
if e.SecurityIdentity == nil || e.Options == nil ||
!e.Options.IsEnabled(option.ConntrackLocal) {
return false
}
return true
} | go | func (e *Endpoint) ConntrackLocalLocked() bool {
if e.SecurityIdentity == nil || e.Options == nil ||
!e.Options.IsEnabled(option.ConntrackLocal) {
return false
}
return true
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"ConntrackLocalLocked",
"(",
")",
"bool",
"{",
"if",
"e",
".",
"SecurityIdentity",
"==",
"nil",
"||",
"e",
".",
"Options",
"==",
"nil",
"||",
"!",
"e",
".",
"Options",
".",
"IsEnabled",
"(",
"option",
".",
"Con... | // ConntrackLocalLocked is the same as ConntrackLocal, but assumes that the
// endpoint is already locked for reading. | [
"ConntrackLocalLocked",
"is",
"the",
"same",
"as",
"ConntrackLocal",
"but",
"assumes",
"that",
"the",
"endpoint",
"is",
"already",
"locked",
"for",
"reading",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1006-L1013 |
163,131 | cilium/cilium | pkg/endpoint/endpoint.go | base64 | func (e *Endpoint) base64() (string, error) {
var (
jsonBytes []byte
err error
)
transformEndpointForDowngrade(e)
jsonBytes, err = json.Marshal(e)
if err != nil {
return "", err
}
return base64.StdEncoding.EncodeToString(jsonBytes), nil
} | go | func (e *Endpoint) base64() (string, error) {
var (
jsonBytes []byte
err error
)
transformEndpointForDowngrade(e)
jsonBytes, err = json.Marshal(e)
if err != nil {
return "", err
}
return base64.StdEncoding.EncodeToString(jsonBytes), nil
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"base64",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"(",
"jsonBytes",
"[",
"]",
"byte",
"\n",
"err",
"error",
"\n",
")",
"\n\n",
"transformEndpointForDowngrade",
"(",
"e",
")",
"\n",
"jsonBytes",
... | // base64 returns the endpoint in a base64 format. | [
"base64",
"returns",
"the",
"endpoint",
"in",
"a",
"base64",
"format",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1016-L1028 |
163,132 | cilium/cilium | pkg/endpoint/endpoint.go | parseBase64ToEndpoint | func parseBase64ToEndpoint(str string, ep *Endpoint) error {
jsonBytes, err := base64.StdEncoding.DecodeString(str)
if err != nil {
return err
}
return json.Unmarshal(jsonBytes, ep)
} | go | func parseBase64ToEndpoint(str string, ep *Endpoint) error {
jsonBytes, err := base64.StdEncoding.DecodeString(str)
if err != nil {
return err
}
return json.Unmarshal(jsonBytes, ep)
} | [
"func",
"parseBase64ToEndpoint",
"(",
"str",
"string",
",",
"ep",
"*",
"Endpoint",
")",
"error",
"{",
"jsonBytes",
",",
"err",
":=",
"base64",
".",
"StdEncoding",
".",
"DecodeString",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",... | // parseBase64ToEndpoint parses the endpoint stored in the given base64 string. | [
"parseBase64ToEndpoint",
"parses",
"the",
"endpoint",
"stored",
"in",
"the",
"given",
"base64",
"string",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1031-L1037 |
163,133 | cilium/cilium | pkg/endpoint/endpoint.go | FilterEPDir | func FilterEPDir(dirFiles []os.FileInfo) []string {
eptsID := []string{}
for _, file := range dirFiles {
if file.IsDir() {
_, err := strconv.ParseUint(file.Name(), 10, 16)
if err == nil || strings.HasSuffix(file.Name(), "_next") || strings.HasSuffix(file.Name(), "_next_fail") {
eptsID = append(eptsID, fil... | go | func FilterEPDir(dirFiles []os.FileInfo) []string {
eptsID := []string{}
for _, file := range dirFiles {
if file.IsDir() {
_, err := strconv.ParseUint(file.Name(), 10, 16)
if err == nil || strings.HasSuffix(file.Name(), "_next") || strings.HasSuffix(file.Name(), "_next_fail") {
eptsID = append(eptsID, fil... | [
"func",
"FilterEPDir",
"(",
"dirFiles",
"[",
"]",
"os",
".",
"FileInfo",
")",
"[",
"]",
"string",
"{",
"eptsID",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"file",
":=",
"range",
"dirFiles",
"{",
"if",
"file",
".",
"IsDir",
"(",
"... | // FilterEPDir returns a list of directories' names that possible belong to an endpoint. | [
"FilterEPDir",
"returns",
"a",
"list",
"of",
"directories",
"names",
"that",
"possible",
"belong",
"to",
"an",
"endpoint",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1040-L1051 |
163,134 | cilium/cilium | pkg/endpoint/endpoint.go | LogStatusOKLocked | func (e *Endpoint) LogStatusOKLocked(typ StatusType, msg string) {
e.logStatusLocked(typ, OK, msg)
} | go | func (e *Endpoint) LogStatusOKLocked(typ StatusType, msg string) {
e.logStatusLocked(typ, OK, msg)
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"LogStatusOKLocked",
"(",
"typ",
"StatusType",
",",
"msg",
"string",
")",
"{",
"e",
".",
"logStatusLocked",
"(",
"typ",
",",
"OK",
",",
"msg",
")",
"\n",
"}"
] | // LogStatusOKLocked will log an OK message of the given status type with the
// given msg string.
// must be called with endpoint.Mutex held | [
"LogStatusOKLocked",
"will",
"log",
"an",
"OK",
"message",
"of",
"the",
"given",
"status",
"type",
"with",
"the",
"given",
"msg",
"string",
".",
"must",
"be",
"called",
"with",
"endpoint",
".",
"Mutex",
"held"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1114-L1116 |
163,135 | cilium/cilium | pkg/endpoint/endpoint.go | logStatusLocked | func (e *Endpoint) logStatusLocked(typ StatusType, code StatusCode, msg string) {
e.Status.indexMU.Lock()
defer e.Status.indexMU.Unlock()
sts := &statusLogMsg{
Status: Status{
Code: code,
Msg: msg,
Type: typ,
State: e.state,
},
Timestamp: time.Now().UTC(),
}
e.Status.addStatusLog(sts)
e.getL... | go | func (e *Endpoint) logStatusLocked(typ StatusType, code StatusCode, msg string) {
e.Status.indexMU.Lock()
defer e.Status.indexMU.Unlock()
sts := &statusLogMsg{
Status: Status{
Code: code,
Msg: msg,
Type: typ,
State: e.state,
},
Timestamp: time.Now().UTC(),
}
e.Status.addStatusLog(sts)
e.getL... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"logStatusLocked",
"(",
"typ",
"StatusType",
",",
"code",
"StatusCode",
",",
"msg",
"string",
")",
"{",
"e",
".",
"Status",
".",
"indexMU",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"Status",
".",
"indexM... | // logStatusLocked logs a status message
// must be called with endpoint.Mutex held | [
"logStatusLocked",
"logs",
"a",
"status",
"message",
"must",
"be",
"called",
"with",
"endpoint",
".",
"Mutex",
"held"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1120-L1139 |
163,136 | cilium/cilium | pkg/endpoint/endpoint.go | HasLabels | func (e *Endpoint) HasLabels(l pkgLabels.Labels) bool {
e.UnconditionalRLock()
defer e.RUnlock()
return e.hasLabelsRLocked(l)
} | go | func (e *Endpoint) HasLabels(l pkgLabels.Labels) bool {
e.UnconditionalRLock()
defer e.RUnlock()
return e.hasLabelsRLocked(l)
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"HasLabels",
"(",
"l",
"pkgLabels",
".",
"Labels",
")",
"bool",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"defer",
"e",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"e",
".",
"hasLabelsRLocked",
"(",
... | // HasLabels returns whether endpoint e contains all labels l. Will return 'false'
// if any label in l is not in the endpoint's labels. | [
"HasLabels",
"returns",
"whether",
"endpoint",
"e",
"contains",
"all",
"labels",
"l",
".",
"Will",
"return",
"false",
"if",
"any",
"label",
"in",
"l",
"is",
"not",
"in",
"the",
"endpoint",
"s",
"labels",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1244-L1249 |
163,137 | cilium/cilium | pkg/endpoint/endpoint.go | hasLabelsRLocked | func (e *Endpoint) hasLabelsRLocked(l pkgLabels.Labels) bool {
allEpLabels := e.OpLabels.AllLabels()
for _, v := range l {
found := false
for _, j := range allEpLabels {
if j.Equals(&v) {
found = true
break
}
}
if !found {
return false
}
}
return true
} | go | func (e *Endpoint) hasLabelsRLocked(l pkgLabels.Labels) bool {
allEpLabels := e.OpLabels.AllLabels()
for _, v := range l {
found := false
for _, j := range allEpLabels {
if j.Equals(&v) {
found = true
break
}
}
if !found {
return false
}
}
return true
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"hasLabelsRLocked",
"(",
"l",
"pkgLabels",
".",
"Labels",
")",
"bool",
"{",
"allEpLabels",
":=",
"e",
".",
"OpLabels",
".",
"AllLabels",
"(",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"l",
"{",
"found",... | // hasLabelsRLocked returns whether endpoint e contains all labels l. Will
// return 'false' if any label in l is not in the endpoint's labels.
// e.Mutex must be RLocked | [
"hasLabelsRLocked",
"returns",
"whether",
"endpoint",
"e",
"contains",
"all",
"labels",
"l",
".",
"Will",
"return",
"false",
"if",
"any",
"label",
"in",
"l",
"is",
"not",
"in",
"the",
"endpoint",
"s",
"labels",
".",
"e",
".",
"Mutex",
"must",
"be",
"RLoc... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1254-L1271 |
163,138 | cilium/cilium | pkg/endpoint/endpoint.go | RegenerateWait | func (e *Endpoint) RegenerateWait(owner Owner, reason string) error {
if !<-e.Regenerate(owner, &ExternalRegenerationMetadata{Reason: reason}) {
return fmt.Errorf("error while regenerating endpoint."+
" For more info run: 'cilium endpoint get %d'", e.ID)
}
return nil
} | go | func (e *Endpoint) RegenerateWait(owner Owner, reason string) error {
if !<-e.Regenerate(owner, &ExternalRegenerationMetadata{Reason: reason}) {
return fmt.Errorf("error while regenerating endpoint."+
" For more info run: 'cilium endpoint get %d'", e.ID)
}
return nil
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"RegenerateWait",
"(",
"owner",
"Owner",
",",
"reason",
"string",
")",
"error",
"{",
"if",
"!",
"<-",
"e",
".",
"Regenerate",
"(",
"owner",
",",
"&",
"ExternalRegenerationMetadata",
"{",
"Reason",
":",
"reason",
"}... | // RegenerateWait should only be called when endpoint's state has successfully
// been changed to "waiting-to-regenerate" | [
"RegenerateWait",
"should",
"only",
"be",
"called",
"when",
"endpoint",
"s",
"state",
"has",
"successfully",
"been",
"changed",
"to",
"waiting",
"-",
"to",
"-",
"regenerate"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1373-L1379 |
163,139 | cilium/cilium | pkg/endpoint/endpoint.go | SetContainerName | func (e *Endpoint) SetContainerName(name string) {
e.UnconditionalLock()
e.ContainerName = name
e.Unlock()
} | go | func (e *Endpoint) SetContainerName(name string) {
e.UnconditionalLock()
e.ContainerName = name
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetContainerName",
"(",
"name",
"string",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"ContainerName",
"=",
"name",
"\n",
"e",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // SetContainerName modifies the endpoint's container name | [
"SetContainerName",
"modifies",
"the",
"endpoint",
"s",
"container",
"name"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1382-L1386 |
163,140 | cilium/cilium | pkg/endpoint/endpoint.go | GetK8sNamespace | func (e *Endpoint) GetK8sNamespace() string {
e.UnconditionalRLock()
ns := e.K8sNamespace
e.RUnlock()
return ns
} | go | func (e *Endpoint) GetK8sNamespace() string {
e.UnconditionalRLock()
ns := e.K8sNamespace
e.RUnlock()
return ns
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetK8sNamespace",
"(",
")",
"string",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"ns",
":=",
"e",
".",
"K8sNamespace",
"\n",
"e",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"ns",
"\n",
"}"
] | // GetK8sNamespace returns the name of the pod if the endpoint represents a
// Kubernetes pod | [
"GetK8sNamespace",
"returns",
"the",
"name",
"of",
"the",
"pod",
"if",
"the",
"endpoint",
"represents",
"a",
"Kubernetes",
"pod"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1390-L1395 |
163,141 | cilium/cilium | pkg/endpoint/endpoint.go | SetK8sNamespace | func (e *Endpoint) SetK8sNamespace(name string) {
e.UnconditionalLock()
e.K8sNamespace = name
e.UpdateLogger(map[string]interface{}{
logfields.K8sPodName: e.GetK8sNamespaceAndPodNameLocked(),
})
e.Unlock()
} | go | func (e *Endpoint) SetK8sNamespace(name string) {
e.UnconditionalLock()
e.K8sNamespace = name
e.UpdateLogger(map[string]interface{}{
logfields.K8sPodName: e.GetK8sNamespaceAndPodNameLocked(),
})
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetK8sNamespace",
"(",
"name",
"string",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"K8sNamespace",
"=",
"name",
"\n",
"e",
".",
"UpdateLogger",
"(",
"map",
"[",
"string",
"]",
"interface... | // SetK8sNamespace modifies the endpoint's pod name | [
"SetK8sNamespace",
"modifies",
"the",
"endpoint",
"s",
"pod",
"name"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1398-L1405 |
163,142 | cilium/cilium | pkg/endpoint/endpoint.go | GetK8sPodName | func (e *Endpoint) GetK8sPodName() string {
e.UnconditionalRLock()
k8sPodName := e.K8sPodName
e.RUnlock()
return k8sPodName
} | go | func (e *Endpoint) GetK8sPodName() string {
e.UnconditionalRLock()
k8sPodName := e.K8sPodName
e.RUnlock()
return k8sPodName
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetK8sPodName",
"(",
")",
"string",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"k8sPodName",
":=",
"e",
".",
"K8sPodName",
"\n",
"e",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"k8sPodName",
"\n",
"}"... | // GetK8sPodName returns the name of the pod if the endpoint represents a
// Kubernetes pod | [
"GetK8sPodName",
"returns",
"the",
"name",
"of",
"the",
"pod",
"if",
"the",
"endpoint",
"represents",
"a",
"Kubernetes",
"pod"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1409-L1415 |
163,143 | cilium/cilium | pkg/endpoint/endpoint.go | HumanStringLocked | func (e *Endpoint) HumanStringLocked() string {
if pod := e.GetK8sNamespaceAndPodNameLocked(); pod != "" {
return pod
}
return e.StringID()
} | go | func (e *Endpoint) HumanStringLocked() string {
if pod := e.GetK8sNamespaceAndPodNameLocked(); pod != "" {
return pod
}
return e.StringID()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"HumanStringLocked",
"(",
")",
"string",
"{",
"if",
"pod",
":=",
"e",
".",
"GetK8sNamespaceAndPodNameLocked",
"(",
")",
";",
"pod",
"!=",
"\"",
"\"",
"{",
"return",
"pod",
"\n",
"}",
"\n\n",
"return",
"e",
".",
... | // HumanStringLocked returns the endpoint's most human readable identifier as string | [
"HumanStringLocked",
"returns",
"the",
"endpoint",
"s",
"most",
"human",
"readable",
"identifier",
"as",
"string"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1418-L1424 |
163,144 | cilium/cilium | pkg/endpoint/endpoint.go | SetK8sPodName | func (e *Endpoint) SetK8sPodName(name string) {
e.UnconditionalLock()
e.K8sPodName = name
e.UpdateLogger(map[string]interface{}{
logfields.K8sPodName: e.GetK8sNamespaceAndPodNameLocked(),
})
e.Unlock()
} | go | func (e *Endpoint) SetK8sPodName(name string) {
e.UnconditionalLock()
e.K8sPodName = name
e.UpdateLogger(map[string]interface{}{
logfields.K8sPodName: e.GetK8sNamespaceAndPodNameLocked(),
})
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetK8sPodName",
"(",
"name",
"string",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"K8sPodName",
"=",
"name",
"\n",
"e",
".",
"UpdateLogger",
"(",
"map",
"[",
"string",
"]",
"interface",
... | // SetK8sPodName modifies the endpoint's pod name | [
"SetK8sPodName",
"modifies",
"the",
"endpoint",
"s",
"pod",
"name"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1433-L1440 |
163,145 | cilium/cilium | pkg/endpoint/endpoint.go | SetContainerID | func (e *Endpoint) SetContainerID(id string) {
e.UnconditionalLock()
e.ContainerID = id
e.UpdateLogger(map[string]interface{}{
logfields.ContainerID: e.getShortContainerID(),
})
e.Unlock()
} | go | func (e *Endpoint) SetContainerID(id string) {
e.UnconditionalLock()
e.ContainerID = id
e.UpdateLogger(map[string]interface{}{
logfields.ContainerID: e.getShortContainerID(),
})
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetContainerID",
"(",
"id",
"string",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"ContainerID",
"=",
"id",
"\n",
"e",
".",
"UpdateLogger",
"(",
"map",
"[",
"string",
"]",
"interface",
"... | // SetContainerID modifies the endpoint's container ID | [
"SetContainerID",
"modifies",
"the",
"endpoint",
"s",
"container",
"ID"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1443-L1450 |
163,146 | cilium/cilium | pkg/endpoint/endpoint.go | GetContainerID | func (e *Endpoint) GetContainerID() string {
e.UnconditionalRLock()
cID := e.ContainerID
e.RUnlock()
return cID
} | go | func (e *Endpoint) GetContainerID() string {
e.UnconditionalRLock()
cID := e.ContainerID
e.RUnlock()
return cID
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetContainerID",
"(",
")",
"string",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"cID",
":=",
"e",
".",
"ContainerID",
"\n",
"e",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"cID",
"\n",
"}"
] | // GetContainerID returns the endpoint's container ID | [
"GetContainerID",
"returns",
"the",
"endpoint",
"s",
"container",
"ID"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1453-L1458 |
163,147 | cilium/cilium | pkg/endpoint/endpoint.go | GetShortContainerID | func (e *Endpoint) GetShortContainerID() string {
e.UnconditionalRLock()
defer e.RUnlock()
return e.getShortContainerID()
} | go | func (e *Endpoint) GetShortContainerID() string {
e.UnconditionalRLock()
defer e.RUnlock()
return e.getShortContainerID()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetShortContainerID",
"(",
")",
"string",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"defer",
"e",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"e",
".",
"getShortContainerID",
"(",
")",
"\n",
"}"
] | // GetShortContainerID returns the endpoint's shortened container ID | [
"GetShortContainerID",
"returns",
"the",
"endpoint",
"s",
"shortened",
"container",
"ID"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1461-L1466 |
163,148 | cilium/cilium | pkg/endpoint/endpoint.go | SetDockerEndpointID | func (e *Endpoint) SetDockerEndpointID(id string) {
e.UnconditionalLock()
e.DockerEndpointID = id
e.Unlock()
} | go | func (e *Endpoint) SetDockerEndpointID(id string) {
e.UnconditionalLock()
e.DockerEndpointID = id
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetDockerEndpointID",
"(",
"id",
"string",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"DockerEndpointID",
"=",
"id",
"\n",
"e",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // SetDockerEndpointID modifies the endpoint's Docker Endpoint ID | [
"SetDockerEndpointID",
"modifies",
"the",
"endpoint",
"s",
"Docker",
"Endpoint",
"ID"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1483-L1487 |
163,149 | cilium/cilium | pkg/endpoint/endpoint.go | SetDockerNetworkID | func (e *Endpoint) SetDockerNetworkID(id string) {
e.UnconditionalLock()
e.DockerNetworkID = id
e.Unlock()
} | go | func (e *Endpoint) SetDockerNetworkID(id string) {
e.UnconditionalLock()
e.DockerNetworkID = id
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetDockerNetworkID",
"(",
"id",
"string",
")",
"{",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"e",
".",
"DockerNetworkID",
"=",
"id",
"\n",
"e",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // SetDockerNetworkID modifies the endpoint's Docker Endpoint ID | [
"SetDockerNetworkID",
"modifies",
"the",
"endpoint",
"s",
"Docker",
"Endpoint",
"ID"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1490-L1494 |
163,150 | cilium/cilium | pkg/endpoint/endpoint.go | GetDockerNetworkID | func (e *Endpoint) GetDockerNetworkID() string {
e.UnconditionalRLock()
defer e.RUnlock()
return e.DockerNetworkID
} | go | func (e *Endpoint) GetDockerNetworkID() string {
e.UnconditionalRLock()
defer e.RUnlock()
return e.DockerNetworkID
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"GetDockerNetworkID",
"(",
")",
"string",
"{",
"e",
".",
"UnconditionalRLock",
"(",
")",
"\n",
"defer",
"e",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"e",
".",
"DockerNetworkID",
"\n",
"}"
] | // GetDockerNetworkID returns the endpoint's Docker Endpoint ID | [
"GetDockerNetworkID",
"returns",
"the",
"endpoint",
"s",
"Docker",
"Endpoint",
"ID"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1497-L1502 |
163,151 | cilium/cilium | pkg/endpoint/endpoint.go | SetDatapathMapIDAndPinMapLocked | func (e *Endpoint) SetDatapathMapIDAndPinMapLocked(id int) error {
e.DatapathMapID = id
return e.PinDatapathMap()
} | go | func (e *Endpoint) SetDatapathMapIDAndPinMapLocked(id int) error {
e.DatapathMapID = id
return e.PinDatapathMap()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetDatapathMapIDAndPinMapLocked",
"(",
"id",
"int",
")",
"error",
"{",
"e",
".",
"DatapathMapID",
"=",
"id",
"\n",
"return",
"e",
".",
"PinDatapathMap",
"(",
")",
"\n",
"}"
] | // SetDatapathMapIDAndPinMapLocked modifies the endpoint's datapath map ID | [
"SetDatapathMapIDAndPinMapLocked",
"modifies",
"the",
"endpoint",
"s",
"datapath",
"map",
"ID"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1505-L1508 |
163,152 | cilium/cilium | pkg/endpoint/endpoint.go | SetStateLocked | func (e *Endpoint) SetStateLocked(toState, reason string) bool {
// Validate the state transition.
fromState := e.state
switch fromState { // From state
case "": // Special case for capturing initial state transitions like
// nil --> StateWaitingForIdentity, StateRestoring
switch toState {
case StateWaitingF... | go | func (e *Endpoint) SetStateLocked(toState, reason string) bool {
// Validate the state transition.
fromState := e.state
switch fromState { // From state
case "": // Special case for capturing initial state transitions like
// nil --> StateWaitingForIdentity, StateRestoring
switch toState {
case StateWaitingF... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetStateLocked",
"(",
"toState",
",",
"reason",
"string",
")",
"bool",
"{",
"// Validate the state transition.",
"fromState",
":=",
"e",
".",
"state",
"\n\n",
"switch",
"fromState",
"{",
"// From state",
"case",
"\"",
"... | // SetStateLocked modifies the endpoint's state
// endpoint.Mutex must be held
// Returns true only if endpoints state was changed as requested | [
"SetStateLocked",
"modifies",
"the",
"endpoint",
"s",
"state",
"endpoint",
".",
"Mutex",
"must",
"be",
"held",
"Returns",
"true",
"only",
"if",
"endpoints",
"state",
"was",
"changed",
"as",
"requested"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1532-L1615 |
163,153 | cilium/cilium | pkg/endpoint/endpoint.go | BuilderSetStateLocked | func (e *Endpoint) BuilderSetStateLocked(toState, reason string) bool {
// Validate the state transition.
fromState := e.state
switch fromState { // From state
case StateCreating, StateWaitingForIdentity, StateReady, StateDisconnecting, StateDisconnected:
// No valid transitions for the builder
case StateWaiting... | go | func (e *Endpoint) BuilderSetStateLocked(toState, reason string) bool {
// Validate the state transition.
fromState := e.state
switch fromState { // From state
case StateCreating, StateWaitingForIdentity, StateReady, StateDisconnecting, StateDisconnected:
// No valid transitions for the builder
case StateWaiting... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"BuilderSetStateLocked",
"(",
"toState",
",",
"reason",
"string",
")",
"bool",
"{",
"// Validate the state transition.",
"fromState",
":=",
"e",
".",
"state",
"\n",
"switch",
"fromState",
"{",
"// From state",
"case",
"Sta... | // BuilderSetStateLocked modifies the endpoint's state
// endpoint.Mutex must be held
// endpoint BuildMutex must be held! | [
"BuilderSetStateLocked",
"modifies",
"the",
"endpoint",
"s",
"state",
"endpoint",
".",
"Mutex",
"must",
"be",
"held",
"endpoint",
"BuildMutex",
"must",
"be",
"held!"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1620-L1682 |
163,154 | cilium/cilium | pkg/endpoint/endpoint.go | OnProxyPolicyUpdate | func (e *Endpoint) OnProxyPolicyUpdate(revision uint64) {
// NOTE: UnconditionalLock is used here because this callback has no way of reporting an error
e.UnconditionalLock()
if revision > e.proxyPolicyRevision {
e.proxyPolicyRevision = revision
}
e.Unlock()
} | go | func (e *Endpoint) OnProxyPolicyUpdate(revision uint64) {
// NOTE: UnconditionalLock is used here because this callback has no way of reporting an error
e.UnconditionalLock()
if revision > e.proxyPolicyRevision {
e.proxyPolicyRevision = revision
}
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"OnProxyPolicyUpdate",
"(",
"revision",
"uint64",
")",
"{",
"// NOTE: UnconditionalLock is used here because this callback has no way of reporting an error",
"e",
".",
"UnconditionalLock",
"(",
")",
"\n",
"if",
"revision",
">",
"e",... | // OnProxyPolicyUpdate is a callback used to update the Endpoint's
// proxyPolicyRevision when the specified revision has been applied in the
// proxy. | [
"OnProxyPolicyUpdate",
"is",
"a",
"callback",
"used",
"to",
"update",
"the",
"Endpoint",
"s",
"proxyPolicyRevision",
"when",
"the",
"specified",
"revision",
"has",
"been",
"applied",
"in",
"the",
"proxy",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1687-L1694 |
163,155 | cilium/cilium | pkg/endpoint/endpoint.go | getProxyStatisticsLocked | func (e *Endpoint) getProxyStatisticsLocked(l7Protocol string, port uint16, ingress bool) *models.ProxyStatistics {
var location string
if ingress {
location = models.ProxyStatisticsLocationIngress
} else {
location = models.ProxyStatisticsLocationEgress
}
key := models.ProxyStatistics{
Location: location,
... | go | func (e *Endpoint) getProxyStatisticsLocked(l7Protocol string, port uint16, ingress bool) *models.ProxyStatistics {
var location string
if ingress {
location = models.ProxyStatisticsLocationIngress
} else {
location = models.ProxyStatisticsLocationEgress
}
key := models.ProxyStatistics{
Location: location,
... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"getProxyStatisticsLocked",
"(",
"l7Protocol",
"string",
",",
"port",
"uint16",
",",
"ingress",
"bool",
")",
"*",
"models",
".",
"ProxyStatistics",
"{",
"var",
"location",
"string",
"\n",
"if",
"ingress",
"{",
"locatio... | // getProxyStatisticsLocked gets the ProxyStatistics for the flows with the
// given characteristics, or adds a new one and returns it.
// Must be called with e.proxyStatisticsMutex held. | [
"getProxyStatisticsLocked",
"gets",
"the",
"ProxyStatistics",
"for",
"the",
"flows",
"with",
"the",
"given",
"characteristics",
"or",
"adds",
"a",
"new",
"one",
"and",
"returns",
"it",
".",
"Must",
"be",
"called",
"with",
"e",
".",
"proxyStatisticsMutex",
"held"... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1699-L1728 |
163,156 | cilium/cilium | pkg/endpoint/endpoint.go | UpdateProxyStatistics | func (e *Endpoint) UpdateProxyStatistics(l7Protocol string, port uint16, ingress, request bool, verdict accesslog.FlowVerdict) {
e.proxyStatisticsMutex.Lock()
defer e.proxyStatisticsMutex.Unlock()
proxyStats := e.getProxyStatisticsLocked(l7Protocol, port, ingress)
var stats *models.MessageForwardingStatistics
if... | go | func (e *Endpoint) UpdateProxyStatistics(l7Protocol string, port uint16, ingress, request bool, verdict accesslog.FlowVerdict) {
e.proxyStatisticsMutex.Lock()
defer e.proxyStatisticsMutex.Unlock()
proxyStats := e.getProxyStatisticsLocked(l7Protocol, port, ingress)
var stats *models.MessageForwardingStatistics
if... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"UpdateProxyStatistics",
"(",
"l7Protocol",
"string",
",",
"port",
"uint16",
",",
"ingress",
",",
"request",
"bool",
",",
"verdict",
"accesslog",
".",
"FlowVerdict",
")",
"{",
"e",
".",
"proxyStatisticsMutex",
".",
"Lo... | // UpdateProxyStatistics updates the Endpoint's proxy statistics to account
// for a new observed flow with the given characteristics. | [
"UpdateProxyStatistics",
"updates",
"the",
"Endpoint",
"s",
"proxy",
"statistics",
"to",
"account",
"for",
"a",
"new",
"observed",
"flow",
"with",
"the",
"given",
"characteristics",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1732-L1759 |
163,157 | cilium/cilium | pkg/endpoint/endpoint.go | APICanModify | func APICanModify(e *Endpoint) error {
if e.IsInit() {
return nil
}
if e.OpLabels.OrchestrationIdentity.IsReserved() {
return fmt.Errorf("endpoint may not be associated reserved labels")
}
return nil
} | go | func APICanModify(e *Endpoint) error {
if e.IsInit() {
return nil
}
if e.OpLabels.OrchestrationIdentity.IsReserved() {
return fmt.Errorf("endpoint may not be associated reserved labels")
}
return nil
} | [
"func",
"APICanModify",
"(",
"e",
"*",
"Endpoint",
")",
"error",
"{",
"if",
"e",
".",
"IsInit",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"e",
".",
"OpLabels",
".",
"OrchestrationIdentity",
".",
"IsReserved",
"(",
")",
"{",
"return",
"fm... | // APICanModify determines whether API requests from a user are allowed to
// modify this endpoint. | [
"APICanModify",
"determines",
"whether",
"API",
"requests",
"from",
"a",
"user",
"are",
"allowed",
"to",
"modify",
"this",
"endpoint",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1763-L1771 |
163,158 | cilium/cilium | pkg/endpoint/endpoint.go | ModifyIdentityLabels | func (e *Endpoint) ModifyIdentityLabels(owner Owner, addLabels, delLabels pkgLabels.Labels) error {
if err := e.LockAlive(); err != nil {
return err
}
switch e.GetStateLocked() {
case StateDisconnected, StateDisconnecting:
e.Unlock()
return nil
}
changed, err := e.OpLabels.ModifyIdentityLabels(addLabels, ... | go | func (e *Endpoint) ModifyIdentityLabels(owner Owner, addLabels, delLabels pkgLabels.Labels) error {
if err := e.LockAlive(); err != nil {
return err
}
switch e.GetStateLocked() {
case StateDisconnected, StateDisconnecting:
e.Unlock()
return nil
}
changed, err := e.OpLabels.ModifyIdentityLabels(addLabels, ... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"ModifyIdentityLabels",
"(",
"owner",
"Owner",
",",
"addLabels",
",",
"delLabels",
"pkgLabels",
".",
"Labels",
")",
"error",
"{",
"if",
"err",
":=",
"e",
".",
"LockAlive",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
... | // ModifyIdentityLabels changes the custom and orchestration identity labels of an endpoint.
// Labels can be added or deleted. If a label change is performed, the
// endpoint will receive a new identity and will be regenerated. Both of these
// operations will happen in the background. | [
"ModifyIdentityLabels",
"changes",
"the",
"custom",
"and",
"orchestration",
"identity",
"labels",
"of",
"an",
"endpoint",
".",
"Labels",
"can",
"be",
"added",
"or",
"deleted",
".",
"If",
"a",
"label",
"change",
"is",
"performed",
"the",
"endpoint",
"will",
"re... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1789-L1822 |
163,159 | cilium/cilium | pkg/endpoint/endpoint.go | UpdateLabels | func (e *Endpoint) UpdateLabels(ctx context.Context, owner Owner, identityLabels, infoLabels pkgLabels.Labels, blocking bool) {
log.WithFields(logrus.Fields{
logfields.ContainerID: e.GetShortContainerID(),
logfields.EndpointID: e.StringID(),
logfields.IdentityLabels: identityLabels.String(),
logfields.I... | go | func (e *Endpoint) UpdateLabels(ctx context.Context, owner Owner, identityLabels, infoLabels pkgLabels.Labels, blocking bool) {
log.WithFields(logrus.Fields{
logfields.ContainerID: e.GetShortContainerID(),
logfields.EndpointID: e.StringID(),
logfields.IdentityLabels: identityLabels.String(),
logfields.I... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"UpdateLabels",
"(",
"ctx",
"context",
".",
"Context",
",",
"owner",
"Owner",
",",
"identityLabels",
",",
"infoLabels",
"pkgLabels",
".",
"Labels",
",",
"blocking",
"bool",
")",
"{",
"log",
".",
"WithFields",
"(",
... | // UpdateLabels is called to update the labels of an endpoint. Calls to this
// function do not necessarily mean that the labels actually changed. The
// container runtime layer will periodically synchronize labels.
//
// If a net label changed was performed, the endpoint will receive a new
// identity and will be rege... | [
"UpdateLabels",
"is",
"called",
"to",
"update",
"the",
"labels",
"of",
"an",
"endpoint",
".",
"Calls",
"to",
"this",
"function",
"do",
"not",
"necessarily",
"mean",
"that",
"the",
"labels",
"actually",
"changed",
".",
"The",
"container",
"runtime",
"layer",
... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1838-L1858 |
163,160 | cilium/cilium | pkg/endpoint/endpoint.go | runLabelsResolver | func (e *Endpoint) runLabelsResolver(ctx context.Context, owner Owner, myChangeRev int, blocking bool) {
if err := e.RLockAlive(); err != nil {
// If a labels update and an endpoint delete API request arrive
// in quick succession, this could occur; in that case, there's
// no point updating the controller.
e.... | go | func (e *Endpoint) runLabelsResolver(ctx context.Context, owner Owner, myChangeRev int, blocking bool) {
if err := e.RLockAlive(); err != nil {
// If a labels update and an endpoint delete API request arrive
// in quick succession, this could occur; in that case, there's
// no point updating the controller.
e.... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"runLabelsResolver",
"(",
"ctx",
"context",
".",
"Context",
",",
"owner",
"Owner",
",",
"myChangeRev",
"int",
",",
"blocking",
"bool",
")",
"{",
"if",
"err",
":=",
"e",
".",
"RLockAlive",
"(",
")",
";",
"err",
... | // Must be called with e.Mutex NOT held. | [
"Must",
"be",
"called",
"with",
"e",
".",
"Mutex",
"NOT",
"held",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L1877-L1925 |
163,161 | cilium/cilium | pkg/endpoint/endpoint.go | SetPolicyRevision | func (e *Endpoint) SetPolicyRevision(rev uint64) {
if err := e.LockAlive(); err != nil {
return
}
e.setPolicyRevision(rev)
e.Unlock()
} | go | func (e *Endpoint) SetPolicyRevision(rev uint64) {
if err := e.LockAlive(); err != nil {
return
}
e.setPolicyRevision(rev)
e.Unlock()
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SetPolicyRevision",
"(",
"rev",
"uint64",
")",
"{",
"if",
"err",
":=",
"e",
".",
"LockAlive",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"e",
".",
"setPolicyRevision",
"(",
"rev",
")"... | // SetPolicyRevision sets the endpoint's policy revision with the given
// revision. | [
"SetPolicyRevision",
"sets",
"the",
"endpoint",
"s",
"policy",
"revision",
"with",
"the",
"given",
"revision",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L2070-L2076 |
163,162 | cilium/cilium | pkg/endpoint/endpoint.go | setPolicyRevision | func (e *Endpoint) setPolicyRevision(rev uint64) {
if rev <= e.policyRevision {
return
}
now := time.Now()
e.policyRevision = rev
e.UpdateLogger(map[string]interface{}{
logfields.DatapathPolicyRevision: e.policyRevision,
})
for ps := range e.policyRevisionSignals {
select {
case <-ps.ctx.Done():
clos... | go | func (e *Endpoint) setPolicyRevision(rev uint64) {
if rev <= e.policyRevision {
return
}
now := time.Now()
e.policyRevision = rev
e.UpdateLogger(map[string]interface{}{
logfields.DatapathPolicyRevision: e.policyRevision,
})
for ps := range e.policyRevisionSignals {
select {
case <-ps.ctx.Done():
clos... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"setPolicyRevision",
"(",
"rev",
"uint64",
")",
"{",
"if",
"rev",
"<=",
"e",
".",
"policyRevision",
"{",
"return",
"\n",
"}",
"\n\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"e",
".",
"policyRevision",... | // setPolicyRevision sets the endpoint's policy revision with the given
// revision. | [
"setPolicyRevision",
"sets",
"the",
"endpoint",
"s",
"policy",
"revision",
"with",
"the",
"given",
"revision",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L2080-L2104 |
163,163 | cilium/cilium | pkg/endpoint/endpoint.go | cleanPolicySignals | func (e *Endpoint) cleanPolicySignals() {
now := time.Now()
for w := range e.policyRevisionSignals {
w.done(now)
close(w.ch)
}
e.policyRevisionSignals = map[*policySignal]bool{}
} | go | func (e *Endpoint) cleanPolicySignals() {
now := time.Now()
for w := range e.policyRevisionSignals {
w.done(now)
close(w.ch)
}
e.policyRevisionSignals = map[*policySignal]bool{}
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"cleanPolicySignals",
"(",
")",
"{",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"for",
"w",
":=",
"range",
"e",
".",
"policyRevisionSignals",
"{",
"w",
".",
"done",
"(",
"now",
")",
"\n",
"close",
"(",
... | // cleanPolicySignals closes and removes all policy revision signals. | [
"cleanPolicySignals",
"closes",
"and",
"removes",
"all",
"policy",
"revision",
"signals",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L2107-L2114 |
163,164 | cilium/cilium | pkg/endpoint/endpoint.go | IPs | func (e *Endpoint) IPs() []net.IP {
ips := []net.IP{}
if e.IPv4.IsSet() {
ips = append(ips, e.IPv4.IP())
}
if e.IPv6.IsSet() {
ips = append(ips, e.IPv6.IP())
}
return ips
} | go | func (e *Endpoint) IPs() []net.IP {
ips := []net.IP{}
if e.IPv4.IsSet() {
ips = append(ips, e.IPv4.IP())
}
if e.IPv6.IsSet() {
ips = append(ips, e.IPv6.IP())
}
return ips
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"IPs",
"(",
")",
"[",
"]",
"net",
".",
"IP",
"{",
"ips",
":=",
"[",
"]",
"net",
".",
"IP",
"{",
"}",
"\n",
"if",
"e",
".",
"IPv4",
".",
"IsSet",
"(",
")",
"{",
"ips",
"=",
"append",
"(",
"ips",
",",... | // IPs returns the slice of valid IPs for this endpoint. | [
"IPs",
"returns",
"the",
"slice",
"of",
"valid",
"IPs",
"for",
"this",
"endpoint",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L2163-L2172 |
163,165 | cilium/cilium | pkg/endpoint/endpoint.go | IsDisconnecting | func (e *Endpoint) IsDisconnecting() bool {
return e.state == StateDisconnected || e.state == StateDisconnecting
} | go | func (e *Endpoint) IsDisconnecting() bool {
return e.state == StateDisconnected || e.state == StateDisconnecting
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"IsDisconnecting",
"(",
")",
"bool",
"{",
"return",
"e",
".",
"state",
"==",
"StateDisconnected",
"||",
"e",
".",
"state",
"==",
"StateDisconnecting",
"\n",
"}"
] | // IsDisconnecting returns true if the endpoint is being disconnected or
// already disconnected
//
// This function must be called after re-aquiring the endpoint mutex to verify
// that the endpoint has not been removed in the meantime.
//
// endpoint.mutex must be held in read mode at least | [
"IsDisconnecting",
"returns",
"true",
"if",
"the",
"endpoint",
"is",
"being",
"disconnected",
"or",
"already",
"disconnected",
"This",
"function",
"must",
"be",
"called",
"after",
"re",
"-",
"aquiring",
"the",
"endpoint",
"mutex",
"to",
"verify",
"that",
"the",
... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L2187-L2189 |
163,166 | cilium/cilium | pkg/endpoint/endpoint.go | PinDatapathMap | func (e *Endpoint) PinDatapathMap() error {
if e.DatapathMapID == 0 {
return nil
}
mapFd, err := bpf.MapFdFromID(e.DatapathMapID)
if err != nil {
return err
}
defer unix.Close(mapFd)
err = bpf.ObjPin(mapFd, e.BPFIpvlanMapPath())
if err == nil {
e.isDatapathMapPinned = true
}
return err
} | go | func (e *Endpoint) PinDatapathMap() error {
if e.DatapathMapID == 0 {
return nil
}
mapFd, err := bpf.MapFdFromID(e.DatapathMapID)
if err != nil {
return err
}
defer unix.Close(mapFd)
err = bpf.ObjPin(mapFd, e.BPFIpvlanMapPath())
if err == nil {
e.isDatapathMapPinned = true
}
return err
} | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"PinDatapathMap",
"(",
")",
"error",
"{",
"if",
"e",
".",
"DatapathMapID",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"mapFd",
",",
"err",
":=",
"bpf",
".",
"MapFdFromID",
"(",
"e",
".",
"DatapathMapID... | // PinDatapathMap retrieves a file descriptor from the map ID from the API call
// and pins the corresponding map into the BPF file system. | [
"PinDatapathMap",
"retrieves",
"a",
"file",
"descriptor",
"from",
"the",
"map",
"ID",
"from",
"the",
"API",
"call",
"and",
"pins",
"the",
"corresponding",
"map",
"into",
"the",
"BPF",
"file",
"system",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L2193-L2211 |
163,167 | cilium/cilium | pkg/endpoint/endpoint.go | SyncEndpointHeaderFile | func (e *Endpoint) SyncEndpointHeaderFile(owner Owner) error {
if err := e.LockAlive(); err != nil {
// endpoint was removed in the meanwhile, return
return nil
}
defer e.Unlock()
if e.dnsHistoryTrigger == nil {
t, err := trigger.NewTrigger(trigger.Parameters{
Name: "sync_endpoint_header_file... | go | func (e *Endpoint) SyncEndpointHeaderFile(owner Owner) error {
if err := e.LockAlive(); err != nil {
// endpoint was removed in the meanwhile, return
return nil
}
defer e.Unlock()
if e.dnsHistoryTrigger == nil {
t, err := trigger.NewTrigger(trigger.Parameters{
Name: "sync_endpoint_header_file... | [
"func",
"(",
"e",
"*",
"Endpoint",
")",
"SyncEndpointHeaderFile",
"(",
"owner",
"Owner",
")",
"error",
"{",
"if",
"err",
":=",
"e",
".",
"LockAlive",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"// endpoint was removed in the meanwhile, return",
"return",
"nil",
... | // SyncEndpointHeaderFile it bumps the current DNS History information for the
// endpoint in the lxc_config.h file. | [
"SyncEndpointHeaderFile",
"it",
"bumps",
"the",
"current",
"DNS",
"History",
"information",
"for",
"the",
"endpoint",
"in",
"the",
"lxc_config",
".",
"h",
"file",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/endpoint/endpoint.go#L2232-L2255 |
163,168 | cilium/cilium | pkg/envoy/sort.go | PortNetworkPolicyRuleLess | func PortNetworkPolicyRuleLess(r1, r2 *cilium.PortNetworkPolicyRule) bool {
// TODO: Support Kafka.
http1, http2 := r1.GetHttpRules(), r2.GetHttpRules()
switch {
case http1 == nil && http2 != nil:
return true
case http1 != nil && http2 == nil:
return false
}
if http1 != nil && http2 != nil {
httpRules1, ... | go | func PortNetworkPolicyRuleLess(r1, r2 *cilium.PortNetworkPolicyRule) bool {
// TODO: Support Kafka.
http1, http2 := r1.GetHttpRules(), r2.GetHttpRules()
switch {
case http1 == nil && http2 != nil:
return true
case http1 != nil && http2 == nil:
return false
}
if http1 != nil && http2 != nil {
httpRules1, ... | [
"func",
"PortNetworkPolicyRuleLess",
"(",
"r1",
",",
"r2",
"*",
"cilium",
".",
"PortNetworkPolicyRule",
")",
"bool",
"{",
"// TODO: Support Kafka.",
"http1",
",",
"http2",
":=",
"r1",
".",
"GetHttpRules",
"(",
")",
",",
"r2",
".",
"GetHttpRules",
"(",
")",
"... | // PortNetworkPolicyRuleLess reports whether the r1 rule should sort before
// the r2 rule.
// L3-L4-only rules are less than L7 rules. | [
"PortNetworkPolicyRuleLess",
"reports",
"whether",
"the",
"r1",
"rule",
"should",
"sort",
"before",
"the",
"r2",
"rule",
".",
"L3",
"-",
"L4",
"-",
"only",
"rules",
"are",
"less",
"than",
"L7",
"rules",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/envoy/sort.go#L87-L138 |
163,169 | cilium/cilium | pkg/envoy/sort.go | HTTPNetworkPolicyRuleLess | func HTTPNetworkPolicyRuleLess(r1, r2 *cilium.HttpNetworkPolicyRule) bool {
headers1, headers2 := r1.Headers, r2.Headers
switch {
case len(headers1) < len(headers2):
return true
case len(headers1) > len(headers2):
return false
}
// Assuming that the slices are sorted.
for idx := range headers1 {
header1, h... | go | func HTTPNetworkPolicyRuleLess(r1, r2 *cilium.HttpNetworkPolicyRule) bool {
headers1, headers2 := r1.Headers, r2.Headers
switch {
case len(headers1) < len(headers2):
return true
case len(headers1) > len(headers2):
return false
}
// Assuming that the slices are sorted.
for idx := range headers1 {
header1, h... | [
"func",
"HTTPNetworkPolicyRuleLess",
"(",
"r1",
",",
"r2",
"*",
"cilium",
".",
"HttpNetworkPolicyRule",
")",
"bool",
"{",
"headers1",
",",
"headers2",
":=",
"r1",
".",
"Headers",
",",
"r2",
".",
"Headers",
"\n",
"switch",
"{",
"case",
"len",
"(",
"headers1... | // HTTPNetworkPolicyRuleLess reports whether the r1 rule should sort before the
// r2 rule. | [
"HTTPNetworkPolicyRuleLess",
"reports",
"whether",
"the",
"r1",
"rule",
"should",
"sort",
"before",
"the",
"r2",
"rule",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/envoy/sort.go#L163-L184 |
163,170 | cilium/cilium | pkg/envoy/sort.go | HeaderMatcherLess | func HeaderMatcherLess(m1, m2 *envoy_api_v2_route.HeaderMatcher) bool {
switch {
case m1.Name < m2.Name:
return true
case m1.Name > m2.Name:
return false
}
// Compare the header_match_specifier oneof field, by comparing each
// possible field in the oneof individually:
// - exactMatch
// - regexMatch
// -... | go | func HeaderMatcherLess(m1, m2 *envoy_api_v2_route.HeaderMatcher) bool {
switch {
case m1.Name < m2.Name:
return true
case m1.Name > m2.Name:
return false
}
// Compare the header_match_specifier oneof field, by comparing each
// possible field in the oneof individually:
// - exactMatch
// - regexMatch
// -... | [
"func",
"HeaderMatcherLess",
"(",
"m1",
",",
"m2",
"*",
"envoy_api_v2_route",
".",
"HeaderMatcher",
")",
"bool",
"{",
"switch",
"{",
"case",
"m1",
".",
"Name",
"<",
"m2",
".",
"Name",
":",
"return",
"true",
"\n",
"case",
"m1",
".",
"Name",
">",
"m2",
... | // HeaderMatcherLess reports whether the m1 matcher should sort before the m2
// matcher. | [
"HeaderMatcherLess",
"reports",
"whether",
"the",
"m1",
"matcher",
"should",
"sort",
"before",
"the",
"m2",
"matcher",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/envoy/sort.go#L209-L302 |
163,171 | cilium/cilium | pkg/maps/metricsmap/metricsmap.go | String | func (k *Key) String() string {
return fmt.Sprintf("reason:%d dir:%d", k.Reason, k.Dir)
} | go | func (k *Key) String() string {
return fmt.Sprintf("reason:%d dir:%d", k.Reason, k.Dir)
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"k",
".",
"Reason",
",",
"k",
".",
"Dir",
")",
"\n",
"}"
] | // String converts the key into a human readable string format | [
"String",
"converts",
"the",
"key",
"into",
"a",
"human",
"readable",
"string",
"format"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/metricsmap/metricsmap.go#L81-L83 |
163,172 | cilium/cilium | pkg/maps/metricsmap/metricsmap.go | Direction | func (k *Key) Direction() string {
switch k.Dir {
case dirIngress:
return direction[k.Dir]
case dirEgress:
return direction[k.Dir]
}
return direction[dirUnknown]
} | go | func (k *Key) Direction() string {
switch k.Dir {
case dirIngress:
return direction[k.Dir]
case dirEgress:
return direction[k.Dir]
}
return direction[dirUnknown]
} | [
"func",
"(",
"k",
"*",
"Key",
")",
"Direction",
"(",
")",
"string",
"{",
"switch",
"k",
".",
"Dir",
"{",
"case",
"dirIngress",
":",
"return",
"direction",
"[",
"k",
".",
"Dir",
"]",
"\n",
"case",
"dirEgress",
":",
"return",
"direction",
"[",
"k",
"... | // Direction gets the direction in human readable string format | [
"Direction",
"gets",
"the",
"direction",
"in",
"human",
"readable",
"string",
"format"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/metricsmap/metricsmap.go#L86-L94 |
163,173 | cilium/cilium | pkg/maps/metricsmap/metricsmap.go | String | func (v *Value) String() string {
return fmt.Sprintf("count:%d bytes:%d", v.Count, v.Bytes)
} | go | func (v *Value) String() string {
return fmt.Sprintf("count:%d bytes:%d", v.Count, v.Bytes)
} | [
"func",
"(",
"v",
"*",
"Value",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Count",
",",
"v",
".",
"Bytes",
")",
"\n",
"}"
] | // String converts the value into a human readable string format | [
"String",
"converts",
"the",
"value",
"into",
"a",
"human",
"readable",
"string",
"format"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/metricsmap/metricsmap.go#L105-L107 |
163,174 | cilium/cilium | pkg/maps/metricsmap/metricsmap.go | updatePrometheusMetrics | func updatePrometheusMetrics(key *Key, val *Value) {
updateMetric(func() (prometheus.Counter, error) {
if key.IsDrop() {
return metrics.DropCount.GetMetricWithLabelValues(key.DropForwardReason(), key.Direction())
}
return metrics.ForwardCount.GetMetricWithLabelValues(key.Direction())
}, val.CountFloat())
u... | go | func updatePrometheusMetrics(key *Key, val *Value) {
updateMetric(func() (prometheus.Counter, error) {
if key.IsDrop() {
return metrics.DropCount.GetMetricWithLabelValues(key.DropForwardReason(), key.Direction())
}
return metrics.ForwardCount.GetMetricWithLabelValues(key.Direction())
}, val.CountFloat())
u... | [
"func",
"updatePrometheusMetrics",
"(",
"key",
"*",
"Key",
",",
"val",
"*",
"Value",
")",
"{",
"updateMetric",
"(",
"func",
"(",
")",
"(",
"prometheus",
".",
"Counter",
",",
"error",
")",
"{",
"if",
"key",
".",
"IsDrop",
"(",
")",
"{",
"return",
"met... | // updatePrometheusMetrics checks the metricsmap key value pair
// and determines which prometheus metrics along with respective labels
// need to be updated. | [
"updatePrometheusMetrics",
"checks",
"the",
"metricsmap",
"key",
"value",
"pair",
"and",
"determines",
"which",
"prometheus",
"metrics",
"along",
"with",
"respective",
"labels",
"need",
"to",
"be",
"updated",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/metricsmap/metricsmap.go#L159-L173 |
163,175 | cilium/cilium | pkg/policy/api/fqdn.go | sanitize | func (s *FQDNSelector) sanitize() error {
if len(s.MatchName) > 0 && !allowedMatchNameChars.MatchString(s.MatchName) {
return fmt.Errorf("Invalid characters in MatchName: \"%s\". Only 0-9, a-z, A-Z and . and - characters are allowed", s.MatchName)
}
if len(s.MatchPattern) > 0 && !allowedPatternChars.MatchString(s... | go | func (s *FQDNSelector) sanitize() error {
if len(s.MatchName) > 0 && !allowedMatchNameChars.MatchString(s.MatchName) {
return fmt.Errorf("Invalid characters in MatchName: \"%s\". Only 0-9, a-z, A-Z and . and - characters are allowed", s.MatchName)
}
if len(s.MatchPattern) > 0 && !allowedPatternChars.MatchString(s... | [
"func",
"(",
"s",
"*",
"FQDNSelector",
")",
"sanitize",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"s",
".",
"MatchName",
")",
">",
"0",
"&&",
"!",
"allowedMatchNameChars",
".",
"MatchString",
"(",
"s",
".",
"MatchName",
")",
"{",
"return",
"fmt",
"."... | // sanitize for FQDNSelector is a little wonky. While we do more processing
// when using MatchName the basic requirement is that is a valid regexp. We
// test that it can compile here. | [
"sanitize",
"for",
"FQDNSelector",
"is",
"a",
"little",
"wonky",
".",
"While",
"we",
"do",
"more",
"processing",
"when",
"using",
"MatchName",
"the",
"basic",
"requirement",
"is",
"that",
"is",
"a",
"valid",
"regexp",
".",
"We",
"test",
"that",
"it",
"can"... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/policy/api/fqdn.go#L60-L70 |
163,176 | cilium/cilium | pkg/policy/api/fqdn.go | Sanitize | func (r *PortRuleDNS) Sanitize() error {
if len(r.MatchName) > 0 && !allowedMatchNameChars.MatchString(r.MatchName) {
return fmt.Errorf("Invalid characters in MatchName: \"%s\". Only 0-9, a-z, A-Z and . and - characters are allowed", r.MatchName)
}
if len(r.MatchPattern) > 0 && !allowedPatternChars.MatchString(r.... | go | func (r *PortRuleDNS) Sanitize() error {
if len(r.MatchName) > 0 && !allowedMatchNameChars.MatchString(r.MatchName) {
return fmt.Errorf("Invalid characters in MatchName: \"%s\". Only 0-9, a-z, A-Z and . and - characters are allowed", r.MatchName)
}
if len(r.MatchPattern) > 0 && !allowedPatternChars.MatchString(r.... | [
"func",
"(",
"r",
"*",
"PortRuleDNS",
")",
"Sanitize",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"r",
".",
"MatchName",
")",
">",
"0",
"&&",
"!",
"allowedMatchNameChars",
".",
"MatchString",
"(",
"r",
".",
"MatchName",
")",
"{",
"return",
"fmt",
".",... | // Sanitize checks that the matchName in the portRule can be compiled as a
// regex. It does not check that a DNS name is a valid DNS name. | [
"Sanitize",
"checks",
"that",
"the",
"matchName",
"in",
"the",
"portRule",
"can",
"be",
"compiled",
"as",
"a",
"regex",
".",
"It",
"does",
"not",
"check",
"that",
"a",
"DNS",
"name",
"is",
"a",
"valid",
"DNS",
"name",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/policy/api/fqdn.go#L77-L87 |
163,177 | cilium/cilium | pkg/policy/api/fqdn.go | GetAsEndpointSelectors | func (s FQDNSelectorSlice) GetAsEndpointSelectors() EndpointSelectorSlice {
for _, rule := range s {
return rule.GetAsEndpointSelectors()
}
return nil
} | go | func (s FQDNSelectorSlice) GetAsEndpointSelectors() EndpointSelectorSlice {
for _, rule := range s {
return rule.GetAsEndpointSelectors()
}
return nil
} | [
"func",
"(",
"s",
"FQDNSelectorSlice",
")",
"GetAsEndpointSelectors",
"(",
")",
"EndpointSelectorSlice",
"{",
"for",
"_",
",",
"rule",
":=",
"range",
"s",
"{",
"return",
"rule",
".",
"GetAsEndpointSelectors",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",... | // GetAsEndpointSelectors will return a single EntityNone if any
// toFQDNs rules exist, and a nil slice otherwise. | [
"GetAsEndpointSelectors",
"will",
"return",
"a",
"single",
"EntityNone",
"if",
"any",
"toFQDNs",
"rules",
"exist",
"and",
"a",
"nil",
"slice",
"otherwise",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/policy/api/fqdn.go#L104-L109 |
163,178 | cilium/cilium | pkg/policy/api/egress.go | GetDestinationEndpointSelectors | func (e *EgressRule) GetDestinationEndpointSelectors() EndpointSelectorSlice {
if e.aggregatedSelectors == nil {
e.SetAggregatedSelectors()
}
return e.aggregatedSelectors
} | go | func (e *EgressRule) GetDestinationEndpointSelectors() EndpointSelectorSlice {
if e.aggregatedSelectors == nil {
e.SetAggregatedSelectors()
}
return e.aggregatedSelectors
} | [
"func",
"(",
"e",
"*",
"EgressRule",
")",
"GetDestinationEndpointSelectors",
"(",
")",
"EndpointSelectorSlice",
"{",
"if",
"e",
".",
"aggregatedSelectors",
"==",
"nil",
"{",
"e",
".",
"SetAggregatedSelectors",
"(",
")",
"\n",
"}",
"\n",
"return",
"e",
".",
"... | // GetDestinationEndpointSelectors returns a slice of endpoints selectors
// covering all L3 destination selectors of the egress rule | [
"GetDestinationEndpointSelectors",
"returns",
"a",
"slice",
"of",
"endpoints",
"selectors",
"covering",
"all",
"L3",
"destination",
"selectors",
"of",
"the",
"egress",
"rule"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/policy/api/egress.go#L172-L177 |
163,179 | cilium/cilium | pkg/policy/api/egress.go | IsLabelBased | func (e *EgressRule) IsLabelBased() bool {
return len(e.ToRequires)+len(e.ToCIDR)+len(e.ToCIDRSet)+len(e.ToServices)+len(e.ToFQDNs) == 0
} | go | func (e *EgressRule) IsLabelBased() bool {
return len(e.ToRequires)+len(e.ToCIDR)+len(e.ToCIDRSet)+len(e.ToServices)+len(e.ToFQDNs) == 0
} | [
"func",
"(",
"e",
"*",
"EgressRule",
")",
"IsLabelBased",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"e",
".",
"ToRequires",
")",
"+",
"len",
"(",
"e",
".",
"ToCIDR",
")",
"+",
"len",
"(",
"e",
".",
"ToCIDRSet",
")",
"+",
"len",
"(",
"e",
"."... | // IsLabelBased returns true whether the L3 destination endpoints are selected
// based on labels, i.e. either by setting ToEndpoints or ToEntities, or not
// setting any To field. | [
"IsLabelBased",
"returns",
"true",
"whether",
"the",
"L3",
"destination",
"endpoints",
"are",
"selected",
"based",
"on",
"labels",
"i",
".",
"e",
".",
"either",
"by",
"setting",
"ToEndpoints",
"or",
"ToEntities",
"or",
"not",
"setting",
"any",
"To",
"field",
... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/policy/api/egress.go#L182-L184 |
163,180 | cilium/cilium | pkg/policy/api/egress.go | CreateDerivative | func (e *EgressRule) CreateDerivative() (*EgressRule, error) {
newRule := e.DeepCopy()
if !e.RequiresDerivative() {
return newRule, nil
}
newRule.ToCIDRSet = CIDRRuleSlice{}
for _, group := range e.ToGroups {
cidrSet, err := group.GetCidrSet()
if err != nil {
return &EgressRule{}, err
}
if len(cidrSet... | go | func (e *EgressRule) CreateDerivative() (*EgressRule, error) {
newRule := e.DeepCopy()
if !e.RequiresDerivative() {
return newRule, nil
}
newRule.ToCIDRSet = CIDRRuleSlice{}
for _, group := range e.ToGroups {
cidrSet, err := group.GetCidrSet()
if err != nil {
return &EgressRule{}, err
}
if len(cidrSet... | [
"func",
"(",
"e",
"*",
"EgressRule",
")",
"CreateDerivative",
"(",
")",
"(",
"*",
"EgressRule",
",",
"error",
")",
"{",
"newRule",
":=",
"e",
".",
"DeepCopy",
"(",
")",
"\n",
"if",
"!",
"e",
".",
"RequiresDerivative",
"(",
")",
"{",
"return",
"newRul... | // CreateDerivative will return a new rule based on the data gathered by the
// rules that creates a new derivative policy.
// In the case of ToGroups will call outside using the groups callback and this
// function can take a bit of time. | [
"CreateDerivative",
"will",
"return",
"a",
"new",
"rule",
"based",
"on",
"the",
"data",
"gathered",
"by",
"the",
"rules",
"that",
"creates",
"a",
"new",
"derivative",
"policy",
".",
"In",
"the",
"case",
"of",
"ToGroups",
"will",
"call",
"outside",
"using",
... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/policy/api/egress.go#L196-L215 |
163,181 | cilium/cilium | pkg/maps/ipcache/ipcache.go | NewKey | func NewKey(ip net.IP, mask net.IPMask) Key {
result := Key{}
ones, _ := mask.Size()
if ip4 := ip.To4(); ip4 != nil {
if mask == nil {
ones = net.IPv4len * 8
}
result.Prefixlen = getPrefixLen(ones)
result.Family = bpf.EndpointKeyIPv4
copy(result.IP[:], ip4)
} else {
if mask == nil {
ones = net.IP... | go | func NewKey(ip net.IP, mask net.IPMask) Key {
result := Key{}
ones, _ := mask.Size()
if ip4 := ip.To4(); ip4 != nil {
if mask == nil {
ones = net.IPv4len * 8
}
result.Prefixlen = getPrefixLen(ones)
result.Family = bpf.EndpointKeyIPv4
copy(result.IP[:], ip4)
} else {
if mask == nil {
ones = net.IP... | [
"func",
"NewKey",
"(",
"ip",
"net",
".",
"IP",
",",
"mask",
"net",
".",
"IPMask",
")",
"Key",
"{",
"result",
":=",
"Key",
"{",
"}",
"\n\n",
"ones",
",",
"_",
":=",
"mask",
".",
"Size",
"(",
")",
"\n",
"if",
"ip4",
":=",
"ip",
".",
"To4",
"(",... | // NewKey returns an Key based on the provided IP address and mask. The address
// family is automatically detected | [
"NewKey",
"returns",
"an",
"Key",
"based",
"on",
"the",
"provided",
"IP",
"address",
"and",
"mask",
".",
"The",
"address",
"family",
"is",
"automatically",
"detected"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/ipcache/ipcache.go#L103-L124 |
163,182 | cilium/cilium | pkg/maps/ipcache/ipcache.go | Delete | func (m *Map) Delete(k bpf.MapKey) error {
_, err := m.delete(k, true)
return err
} | go | func (m *Map) Delete(k bpf.MapKey) error {
_, err := m.delete(k, true)
return err
} | [
"func",
"(",
"m",
"*",
"Map",
")",
"Delete",
"(",
"k",
"bpf",
".",
"MapKey",
")",
"error",
"{",
"_",
",",
"err",
":=",
"m",
".",
"delete",
"(",
"k",
",",
"true",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Delete removes a key from the ipcache BPF map | [
"Delete",
"removes",
"a",
"key",
"from",
"the",
"ipcache",
"BPF",
"map"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/ipcache/ipcache.go#L199-L202 |
163,183 | cilium/cilium | pkg/maps/ipcache/ipcache.go | GetMaxPrefixLengths | func (m *Map) GetMaxPrefixLengths(ipv6 bool) (count int) {
if IPCache.MapType == bpf.BPF_MAP_TYPE_LPM_TRIE {
if ipv6 {
return net.IPv6len*8 + 1
} else {
return net.IPv4len*8 + 1
}
}
if ipv6 {
return maxPrefixLengths6
}
return maxPrefixLengths4
} | go | func (m *Map) GetMaxPrefixLengths(ipv6 bool) (count int) {
if IPCache.MapType == bpf.BPF_MAP_TYPE_LPM_TRIE {
if ipv6 {
return net.IPv6len*8 + 1
} else {
return net.IPv4len*8 + 1
}
}
if ipv6 {
return maxPrefixLengths6
}
return maxPrefixLengths4
} | [
"func",
"(",
"m",
"*",
"Map",
")",
"GetMaxPrefixLengths",
"(",
"ipv6",
"bool",
")",
"(",
"count",
"int",
")",
"{",
"if",
"IPCache",
".",
"MapType",
"==",
"bpf",
".",
"BPF_MAP_TYPE_LPM_TRIE",
"{",
"if",
"ipv6",
"{",
"return",
"net",
".",
"IPv6len",
"*",... | // GetMaxPrefixLengths determines how many unique prefix lengths are supported
// simultaneously based on the underlying BPF map type in use. | [
"GetMaxPrefixLengths",
"determines",
"how",
"many",
"unique",
"prefix",
"lengths",
"are",
"supported",
"simultaneously",
"based",
"on",
"the",
"underlying",
"BPF",
"map",
"type",
"in",
"use",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/ipcache/ipcache.go#L206-L218 |
163,184 | cilium/cilium | api/v1/server/restapi/policy/get_identity_endpoints.go | NewGetIdentityEndpoints | func NewGetIdentityEndpoints(ctx *middleware.Context, handler GetIdentityEndpointsHandler) *GetIdentityEndpoints {
return &GetIdentityEndpoints{Context: ctx, Handler: handler}
} | go | func NewGetIdentityEndpoints(ctx *middleware.Context, handler GetIdentityEndpointsHandler) *GetIdentityEndpoints {
return &GetIdentityEndpoints{Context: ctx, Handler: handler}
} | [
"func",
"NewGetIdentityEndpoints",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"GetIdentityEndpointsHandler",
")",
"*",
"GetIdentityEndpoints",
"{",
"return",
"&",
"GetIdentityEndpoints",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",... | // NewGetIdentityEndpoints creates a new http.Handler for the get identity endpoints operation | [
"NewGetIdentityEndpoints",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"get",
"identity",
"endpoints",
"operation"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/api/v1/server/restapi/policy/get_identity_endpoints.go#L28-L30 |
163,185 | cilium/cilium | api/v1/models/endpoint_configuration_spec.go | Validate | func (m *EndpointConfigurationSpec) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLabelConfiguration(formats); err != nil {
res = append(res, err)
}
if err := m.validateOptions(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidat... | go | func (m *EndpointConfigurationSpec) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLabelConfiguration(formats); err != nil {
res = append(res, err)
}
if err := m.validateOptions(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidat... | [
"func",
"(",
"m",
"*",
"EndpointConfigurationSpec",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateLabelConfiguration",
"(",
"formats",
")",
";",... | // Validate validates this endpoint configuration spec | [
"Validate",
"validates",
"this",
"endpoint",
"configuration",
"spec"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/api/v1/models/endpoint_configuration_spec.go#L27-L42 |
163,186 | cilium/cilium | pkg/kvstore/kvstore.go | GetPrefix | func GetPrefix(ctx context.Context, prefix string) (k string, v []byte, err error) {
k, v, err = Client().GetPrefix(ctx, prefix)
Trace("GetPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldKey: k, fieldValue: string(v)})
return
} | go | func GetPrefix(ctx context.Context, prefix string) (k string, v []byte, err error) {
k, v, err = Client().GetPrefix(ctx, prefix)
Trace("GetPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldKey: k, fieldValue: string(v)})
return
} | [
"func",
"GetPrefix",
"(",
"ctx",
"context",
".",
"Context",
",",
"prefix",
"string",
")",
"(",
"k",
"string",
",",
"v",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"k",
",",
"v",
",",
"err",
"=",
"Client",
"(",
")",
".",
"GetPrefix",
"(",
... | // GetPrefix returns the first key which matches the prefix and its value. | [
"GetPrefix",
"returns",
"the",
"first",
"key",
"which",
"matches",
"the",
"prefix",
"and",
"its",
"value",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/kvstore/kvstore.go#L48-L52 |
163,187 | cilium/cilium | pkg/kvstore/kvstore.go | ListPrefix | func ListPrefix(prefix string) (KeyValuePairs, error) {
v, err := Client().ListPrefix(prefix)
Trace("ListPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)})
return v, err
} | go | func ListPrefix(prefix string) (KeyValuePairs, error) {
v, err := Client().ListPrefix(prefix)
Trace("ListPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)})
return v, err
} | [
"func",
"ListPrefix",
"(",
"prefix",
"string",
")",
"(",
"KeyValuePairs",
",",
"error",
")",
"{",
"v",
",",
"err",
":=",
"Client",
"(",
")",
".",
"ListPrefix",
"(",
"prefix",
")",
"\n",
"Trace",
"(",
"\"",
"\"",
",",
"err",
",",
"logrus",
".",
"Fie... | // ListPrefix returns the list of keys matching the prefix | [
"ListPrefix",
"returns",
"the",
"list",
"of",
"keys",
"matching",
"the",
"prefix"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/kvstore/kvstore.go#L55-L59 |
163,188 | cilium/cilium | pkg/kvstore/kvstore.go | Update | func Update(ctx context.Context, key string, value []byte, lease bool) error {
err := Client().Update(ctx, key, value, lease)
Trace("Update", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldAttachLease: lease})
return err
} | go | func Update(ctx context.Context, key string, value []byte, lease bool) error {
err := Client().Update(ctx, key, value, lease)
Trace("Update", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldAttachLease: lease})
return err
} | [
"func",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"key",
"string",
",",
"value",
"[",
"]",
"byte",
",",
"lease",
"bool",
")",
"error",
"{",
"err",
":=",
"Client",
"(",
")",
".",
"Update",
"(",
"ctx",
",",
"key",
",",
"value",
",",
"le... | // Update creates or updates a key value pair | [
"Update",
"creates",
"or",
"updates",
"a",
"key",
"value",
"pair"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/kvstore/kvstore.go#L73-L77 |
163,189 | cilium/cilium | pkg/kvstore/kvstore.go | Set | func Set(key string, value []byte) error {
err := Client().Set(key, value)
Trace("Set", err, logrus.Fields{fieldKey: key, fieldValue: string(value)})
return err
} | go | func Set(key string, value []byte) error {
err := Client().Set(key, value)
Trace("Set", err, logrus.Fields{fieldKey: key, fieldValue: string(value)})
return err
} | [
"func",
"Set",
"(",
"key",
"string",
",",
"value",
"[",
"]",
"byte",
")",
"error",
"{",
"err",
":=",
"Client",
"(",
")",
".",
"Set",
"(",
"key",
",",
"value",
")",
"\n",
"Trace",
"(",
"\"",
"\"",
",",
"err",
",",
"logrus",
".",
"Fields",
"{",
... | // Set sets the value of a key | [
"Set",
"sets",
"the",
"value",
"of",
"a",
"key"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/kvstore/kvstore.go#L99-L103 |
163,190 | cilium/cilium | pkg/kvstore/kvstore.go | DeletePrefix | func DeletePrefix(prefix string) error {
err := Client().DeletePrefix(prefix)
Trace("DeletePrefix", err, logrus.Fields{fieldPrefix: prefix})
return err
} | go | func DeletePrefix(prefix string) error {
err := Client().DeletePrefix(prefix)
Trace("DeletePrefix", err, logrus.Fields{fieldPrefix: prefix})
return err
} | [
"func",
"DeletePrefix",
"(",
"prefix",
"string",
")",
"error",
"{",
"err",
":=",
"Client",
"(",
")",
".",
"DeletePrefix",
"(",
"prefix",
")",
"\n",
"Trace",
"(",
"\"",
"\"",
",",
"err",
",",
"logrus",
".",
"Fields",
"{",
"fieldPrefix",
":",
"prefix",
... | // DeletePrefix deletes all keys matching a prefix | [
"DeletePrefix",
"deletes",
"all",
"keys",
"matching",
"a",
"prefix"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/kvstore/kvstore.go#L113-L117 |
163,191 | cilium/cilium | api/v1/server/restapi/service/delete_service_id.go | NewDeleteServiceID | func NewDeleteServiceID(ctx *middleware.Context, handler DeleteServiceIDHandler) *DeleteServiceID {
return &DeleteServiceID{Context: ctx, Handler: handler}
} | go | func NewDeleteServiceID(ctx *middleware.Context, handler DeleteServiceIDHandler) *DeleteServiceID {
return &DeleteServiceID{Context: ctx, Handler: handler}
} | [
"func",
"NewDeleteServiceID",
"(",
"ctx",
"*",
"middleware",
".",
"Context",
",",
"handler",
"DeleteServiceIDHandler",
")",
"*",
"DeleteServiceID",
"{",
"return",
"&",
"DeleteServiceID",
"{",
"Context",
":",
"ctx",
",",
"Handler",
":",
"handler",
"}",
"\n",
"}... | // NewDeleteServiceID creates a new http.Handler for the delete service ID operation | [
"NewDeleteServiceID",
"creates",
"a",
"new",
"http",
".",
"Handler",
"for",
"the",
"delete",
"service",
"ID",
"operation"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/api/v1/server/restapi/service/delete_service_id.go#L28-L30 |
163,192 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | checkPrefixlen | func (cm *CIDRMap) checkPrefixlen(key *cidrKey, operation string) error {
if cm.Prefixlen != 0 &&
((cm.PrefixIsDynamic && cm.Prefixlen < key.Prefixlen) ||
(!cm.PrefixIsDynamic && cm.Prefixlen != key.Prefixlen)) {
return fmt.Errorf("Unable to %s element with dynamic prefix length cm.Prefixlen=%d key.Prefixlen=%d... | go | func (cm *CIDRMap) checkPrefixlen(key *cidrKey, operation string) error {
if cm.Prefixlen != 0 &&
((cm.PrefixIsDynamic && cm.Prefixlen < key.Prefixlen) ||
(!cm.PrefixIsDynamic && cm.Prefixlen != key.Prefixlen)) {
return fmt.Errorf("Unable to %s element with dynamic prefix length cm.Prefixlen=%d key.Prefixlen=%d... | [
"func",
"(",
"cm",
"*",
"CIDRMap",
")",
"checkPrefixlen",
"(",
"key",
"*",
"cidrKey",
",",
"operation",
"string",
")",
"error",
"{",
"if",
"cm",
".",
"Prefixlen",
"!=",
"0",
"&&",
"(",
"(",
"cm",
".",
"PrefixIsDynamic",
"&&",
"cm",
".",
"Prefixlen",
... | // checkPrefixlen checks whether it's valid to manipulate elements in the map
// with the specified key. If it's unsupported, it returns an error. | [
"checkPrefixlen",
"checks",
"whether",
"it",
"s",
"valid",
"to",
"manipulate",
"elements",
"in",
"the",
"map",
"with",
"the",
"specified",
"key",
".",
"If",
"it",
"s",
"unsupported",
"it",
"returns",
"an",
"error",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L75-L83 |
163,193 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | InsertCIDR | func (cm *CIDRMap) InsertCIDR(cidr net.IPNet) error {
key := cm.cidrKeyInit(cidr)
entry := [LPM_MAP_VALUE_SIZE]byte{}
if err := cm.checkPrefixlen(&key, "update"); err != nil {
return err
}
log.WithField(logfields.Path, cm.path).Debugf("Inserting CIDR entry %s", cidr.String())
return bpf.UpdateElement(cm.Fd, uns... | go | func (cm *CIDRMap) InsertCIDR(cidr net.IPNet) error {
key := cm.cidrKeyInit(cidr)
entry := [LPM_MAP_VALUE_SIZE]byte{}
if err := cm.checkPrefixlen(&key, "update"); err != nil {
return err
}
log.WithField(logfields.Path, cm.path).Debugf("Inserting CIDR entry %s", cidr.String())
return bpf.UpdateElement(cm.Fd, uns... | [
"func",
"(",
"cm",
"*",
"CIDRMap",
")",
"InsertCIDR",
"(",
"cidr",
"net",
".",
"IPNet",
")",
"error",
"{",
"key",
":=",
"cm",
".",
"cidrKeyInit",
"(",
"cidr",
")",
"\n",
"entry",
":=",
"[",
"LPM_MAP_VALUE_SIZE",
"]",
"byte",
"{",
"}",
"\n",
"if",
"... | // InsertCIDR inserts an entry to 'cm' with key 'cidr'. Value is currently not
// used. | [
"InsertCIDR",
"inserts",
"an",
"entry",
"to",
"cm",
"with",
"key",
"cidr",
".",
"Value",
"is",
"currently",
"not",
"used",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L87-L95 |
163,194 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | DeleteCIDR | func (cm *CIDRMap) DeleteCIDR(cidr net.IPNet) error {
key := cm.cidrKeyInit(cidr)
if err := cm.checkPrefixlen(&key, "delete"); err != nil {
return err
}
log.WithField(logfields.Path, cm.path).Debugf("Removing CIDR entry %s", cidr.String())
return bpf.DeleteElement(cm.Fd, unsafe.Pointer(&key))
} | go | func (cm *CIDRMap) DeleteCIDR(cidr net.IPNet) error {
key := cm.cidrKeyInit(cidr)
if err := cm.checkPrefixlen(&key, "delete"); err != nil {
return err
}
log.WithField(logfields.Path, cm.path).Debugf("Removing CIDR entry %s", cidr.String())
return bpf.DeleteElement(cm.Fd, unsafe.Pointer(&key))
} | [
"func",
"(",
"cm",
"*",
"CIDRMap",
")",
"DeleteCIDR",
"(",
"cidr",
"net",
".",
"IPNet",
")",
"error",
"{",
"key",
":=",
"cm",
".",
"cidrKeyInit",
"(",
"cidr",
")",
"\n",
"if",
"err",
":=",
"cm",
".",
"checkPrefixlen",
"(",
"&",
"key",
",",
"\"",
... | // DeleteCIDR deletes an entry from 'cm' with key 'cidr'. | [
"DeleteCIDR",
"deletes",
"an",
"entry",
"from",
"cm",
"with",
"key",
"cidr",
"."
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L98-L105 |
163,195 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | CIDRExists | func (cm *CIDRMap) CIDRExists(cidr net.IPNet) bool {
key := cm.cidrKeyInit(cidr)
var entry [LPM_MAP_VALUE_SIZE]byte
return bpf.LookupElement(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&entry)) == nil
} | go | func (cm *CIDRMap) CIDRExists(cidr net.IPNet) bool {
key := cm.cidrKeyInit(cidr)
var entry [LPM_MAP_VALUE_SIZE]byte
return bpf.LookupElement(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&entry)) == nil
} | [
"func",
"(",
"cm",
"*",
"CIDRMap",
")",
"CIDRExists",
"(",
"cidr",
"net",
".",
"IPNet",
")",
"bool",
"{",
"key",
":=",
"cm",
".",
"cidrKeyInit",
"(",
"cidr",
")",
"\n",
"var",
"entry",
"[",
"LPM_MAP_VALUE_SIZE",
"]",
"byte",
"\n",
"return",
"bpf",
".... | // CIDRExists returns true if 'cidr' exists in map 'cm' | [
"CIDRExists",
"returns",
"true",
"if",
"cidr",
"exists",
"in",
"map",
"cm"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L108-L112 |
163,196 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | CIDRNext | func (cm *CIDRMap) CIDRNext(cidr *net.IPNet) *net.IPNet {
var key, keyNext cidrKey
if cidr != nil {
key = cm.cidrKeyInit(*cidr)
}
err := bpf.GetNextKey(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&keyNext))
if err != nil {
return nil
}
out := cm.keyCidrInit(keyNext)
return &out
} | go | func (cm *CIDRMap) CIDRNext(cidr *net.IPNet) *net.IPNet {
var key, keyNext cidrKey
if cidr != nil {
key = cm.cidrKeyInit(*cidr)
}
err := bpf.GetNextKey(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&keyNext))
if err != nil {
return nil
}
out := cm.keyCidrInit(keyNext)
return &out
} | [
"func",
"(",
"cm",
"*",
"CIDRMap",
")",
"CIDRNext",
"(",
"cidr",
"*",
"net",
".",
"IPNet",
")",
"*",
"net",
".",
"IPNet",
"{",
"var",
"key",
",",
"keyNext",
"cidrKey",
"\n",
"if",
"cidr",
"!=",
"nil",
"{",
"key",
"=",
"cm",
".",
"cidrKeyInit",
"(... | // CIDRNext returns next CIDR entry in map 'cm' | [
"CIDRNext",
"returns",
"next",
"CIDR",
"entry",
"in",
"map",
"cm"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L115-L126 |
163,197 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | CIDRDump | func (cm *CIDRMap) CIDRDump(to []string) []string {
var key, keyNext *net.IPNet
for {
keyNext = cm.CIDRNext(key)
if keyNext == nil {
return to
}
key = keyNext
to = append(to, key.String())
}
} | go | func (cm *CIDRMap) CIDRDump(to []string) []string {
var key, keyNext *net.IPNet
for {
keyNext = cm.CIDRNext(key)
if keyNext == nil {
return to
}
key = keyNext
to = append(to, key.String())
}
} | [
"func",
"(",
"cm",
"*",
"CIDRMap",
")",
"CIDRDump",
"(",
"to",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"key",
",",
"keyNext",
"*",
"net",
".",
"IPNet",
"\n",
"for",
"{",
"keyNext",
"=",
"cm",
".",
"CIDRNext",
"(",
"key",
")",
"... | // CIDRDump walks map 'cm' and dumps all CIDR entries | [
"CIDRDump",
"walks",
"map",
"cm",
"and",
"dumps",
"all",
"CIDR",
"entries"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L129-L139 |
163,198 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | Close | func (cm *CIDRMap) Close() error {
if cm == nil {
return nil
}
return bpf.ObjClose(cm.Fd)
} | go | func (cm *CIDRMap) Close() error {
if cm == nil {
return nil
}
return bpf.ObjClose(cm.Fd)
} | [
"func",
"(",
"cm",
"*",
"CIDRMap",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"cm",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"bpf",
".",
"ObjClose",
"(",
"cm",
".",
"Fd",
")",
"\n",
"}"
] | // Close closes the FD of the given CIDRMap | [
"Close",
"closes",
"the",
"FD",
"of",
"the",
"given",
"CIDRMap"
] | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L150-L155 |
163,199 | cilium/cilium | pkg/maps/cidrmap/cidrmap.go | OpenMap | func OpenMap(path string, prefixlen int, prefixdyn bool) (*CIDRMap, bool, error) {
return OpenMapElems(path, prefixlen, prefixdyn, MaxEntries)
} | go | func OpenMap(path string, prefixlen int, prefixdyn bool) (*CIDRMap, bool, error) {
return OpenMapElems(path, prefixlen, prefixdyn, MaxEntries)
} | [
"func",
"OpenMap",
"(",
"path",
"string",
",",
"prefixlen",
"int",
",",
"prefixdyn",
"bool",
")",
"(",
"*",
"CIDRMap",
",",
"bool",
",",
"error",
")",
"{",
"return",
"OpenMapElems",
"(",
"path",
",",
"prefixlen",
",",
"prefixdyn",
",",
"MaxEntries",
")",... | // OpenMap opens a new CIDRMap. 'bool' returns 'true' if the map was
// created, and 'false' if the map already existed. prefixdyn denotes
// whether element's prefixlen can vary and we thus need to use a LPM
// trie instead of hash table. | [
"OpenMap",
"opens",
"a",
"new",
"CIDRMap",
".",
"bool",
"returns",
"true",
"if",
"the",
"map",
"was",
"created",
"and",
"false",
"if",
"the",
"map",
"already",
"existed",
".",
"prefixdyn",
"denotes",
"whether",
"element",
"s",
"prefixlen",
"can",
"vary",
"... | 6ecfff82c2314dd9d847645361b57e2646eed64b | https://github.com/cilium/cilium/blob/6ecfff82c2314dd9d847645361b57e2646eed64b/pkg/maps/cidrmap/cidrmap.go#L161-L163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.