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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
26,500 | google/seesaw | common/seesaw/seesaw.go | AF | func (ip IP) AF() AF {
if ip.IP().To4() != nil {
return IPv4
}
return IPv6
} | go | func (ip IP) AF() AF {
if ip.IP().To4() != nil {
return IPv4
}
return IPv6
} | [
"func",
"(",
"ip",
"IP",
")",
"AF",
"(",
")",
"AF",
"{",
"if",
"ip",
".",
"IP",
"(",
")",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"return",
"IPv4",
"\n",
"}",
"\n",
"return",
"IPv6",
"\n",
"}"
] | // AF returns the address family of a seesaw IP address. | [
"AF",
"returns",
"the",
"address",
"family",
"of",
"a",
"seesaw",
"IP",
"address",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/seesaw.go#L260-L265 |
26,501 | google/seesaw | common/seesaw/seesaw.go | String | func (lbm LBMode) String() string {
if name, ok := modeNames[lbm]; ok {
return name
}
return "(unknown)"
} | go | func (lbm LBMode) String() string {
if name, ok := modeNames[lbm]; ok {
return name
}
return "(unknown)"
} | [
"func",
"(",
"lbm",
"LBMode",
")",
"String",
"(",
")",
"string",
"{",
"if",
"name",
",",
"ok",
":=",
"modeNames",
"[",
"lbm",
"]",
";",
"ok",
"{",
"return",
"name",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // String returns the string representation of a LBMode. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"a",
"LBMode",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/seesaw.go#L313-L318 |
26,502 | google/seesaw | common/seesaw/seesaw.go | String | func (lbs LBScheduler) String() string {
if name, ok := schedulerNames[lbs]; ok {
return name
}
return "(unknown)"
} | go | func (lbs LBScheduler) String() string {
if name, ok := schedulerNames[lbs]; ok {
return name
}
return "(unknown)"
} | [
"func",
"(",
"lbs",
"LBScheduler",
")",
"String",
"(",
")",
"string",
"{",
"if",
"name",
",",
"ok",
":=",
"schedulerNames",
"[",
"lbs",
"]",
";",
"ok",
"{",
"return",
"name",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // String returns the string representation of a LBScheduler. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"a",
"LBScheduler",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/seesaw.go#L342-L347 |
26,503 | google/seesaw | healthcheck/dial.go | setSocketMark | func setSocketMark(fd, mark int) error {
if err := syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_MARK, mark); err != nil {
return os.NewSyscallError("failed to set mark", err)
}
return nil
} | go | func setSocketMark(fd, mark int) error {
if err := syscall.SetsockoptInt(fd, syscall.SOL_SOCKET, syscall.SO_MARK, mark); err != nil {
return os.NewSyscallError("failed to set mark", err)
}
return nil
} | [
"func",
"setSocketMark",
"(",
"fd",
",",
"mark",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"syscall",
".",
"SetsockoptInt",
"(",
"fd",
",",
"syscall",
".",
"SOL_SOCKET",
",",
"syscall",
".",
"SO_MARK",
",",
"mark",
")",
";",
"err",
"!=",
"nil",
"{... | // setSocketMark sets packet marking on the given socket. | [
"setSocketMark",
"sets",
"packet",
"marking",
"on",
"the",
"given",
"socket",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/dial.go#L198-L203 |
26,504 | google/seesaw | healthcheck/dial.go | setSocketTimeout | func setSocketTimeout(fd int, timeout time.Duration) error {
tv := syscall.NsecToTimeval(timeout.Nanoseconds())
for _, opt := range []int{syscall.SO_RCVTIMEO, syscall.SO_SNDTIMEO} {
if err := syscall.SetsockoptTimeval(fd, syscall.SOL_SOCKET, opt, &tv); err != nil {
return os.NewSyscallError("setsockopt", err)
... | go | func setSocketTimeout(fd int, timeout time.Duration) error {
tv := syscall.NsecToTimeval(timeout.Nanoseconds())
for _, opt := range []int{syscall.SO_RCVTIMEO, syscall.SO_SNDTIMEO} {
if err := syscall.SetsockoptTimeval(fd, syscall.SOL_SOCKET, opt, &tv); err != nil {
return os.NewSyscallError("setsockopt", err)
... | [
"func",
"setSocketTimeout",
"(",
"fd",
"int",
",",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"tv",
":=",
"syscall",
".",
"NsecToTimeval",
"(",
"timeout",
".",
"Nanoseconds",
"(",
")",
")",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"[",
... | // setSocketTimeout sets the receive and send timeouts on the given socket. | [
"setSocketTimeout",
"sets",
"the",
"receive",
"and",
"send",
"timeouts",
"on",
"the",
"given",
"socket",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/dial.go#L206-L214 |
26,505 | google/seesaw | engine/vserver.go | newVserver | func newVserver(e *Engine) *vserver {
return &vserver{
engine: e,
ncc: ncclient.NewNCC(e.config.NCCSocket),
fwm: make(map[seesaw.AF]uint32),
active: make(map[seesaw.IP]bool),
lbVservers: make(map[seesaw.IP]*seesaw.Vserver),
vips: make(map[seesaw.VIP]bool),
overrideChan: make(chan se... | go | func newVserver(e *Engine) *vserver {
return &vserver{
engine: e,
ncc: ncclient.NewNCC(e.config.NCCSocket),
fwm: make(map[seesaw.AF]uint32),
active: make(map[seesaw.IP]bool),
lbVservers: make(map[seesaw.IP]*seesaw.Vserver),
vips: make(map[seesaw.VIP]bool),
overrideChan: make(chan se... | [
"func",
"newVserver",
"(",
"e",
"*",
"Engine",
")",
"*",
"vserver",
"{",
"return",
"&",
"vserver",
"{",
"engine",
":",
"e",
",",
"ncc",
":",
"ncclient",
".",
"NewNCC",
"(",
"e",
".",
"config",
".",
"NCCSocket",
")",
",",
"fwm",
":",
"make",
"(",
... | // newVserver returns an initialised vserver struct. | [
"newVserver",
"returns",
"an",
"initialised",
"vserver",
"struct",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L61-L78 |
26,506 | google/seesaw | engine/vserver.go | String | func (v *vserver) String() string {
if v.config != nil {
return v.config.Name
}
return fmt.Sprintf("Unconfigured vserver %+v", *v)
} | go | func (v *vserver) String() string {
if v.config != nil {
return v.config.Name
}
return fmt.Sprintf("Unconfigured vserver %+v", *v)
} | [
"func",
"(",
"v",
"*",
"vserver",
")",
"String",
"(",
")",
"string",
"{",
"if",
"v",
".",
"config",
"!=",
"nil",
"{",
"return",
"v",
".",
"config",
".",
"Name",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"*",
"v",
... | // String returns a string representing a vserver. | [
"String",
"returns",
"a",
"string",
"representing",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L81-L86 |
26,507 | google/seesaw | engine/vserver.go | ipvsService | func (svc *service) ipvsService() *ipvs.Service {
var flags ipvs.ServiceFlags
if svc.ventry.Persistence > 0 {
flags |= ipvs.SFPersistent
}
if svc.ventry.OnePacket {
flags |= ipvs.SFOnePacket
}
var ip net.IP
switch {
case svc.fwm > 0 && svc.af == seesaw.IPv4:
ip = net.IPv4zero
case svc.fwm > 0 && svc.af =... | go | func (svc *service) ipvsService() *ipvs.Service {
var flags ipvs.ServiceFlags
if svc.ventry.Persistence > 0 {
flags |= ipvs.SFPersistent
}
if svc.ventry.OnePacket {
flags |= ipvs.SFOnePacket
}
var ip net.IP
switch {
case svc.fwm > 0 && svc.af == seesaw.IPv4:
ip = net.IPv4zero
case svc.fwm > 0 && svc.af =... | [
"func",
"(",
"svc",
"*",
"service",
")",
"ipvsService",
"(",
")",
"*",
"ipvs",
".",
"Service",
"{",
"var",
"flags",
"ipvs",
".",
"ServiceFlags",
"\n",
"if",
"svc",
".",
"ventry",
".",
"Persistence",
">",
"0",
"{",
"flags",
"|=",
"ipvs",
".",
"SFPersi... | // ipvsService returns an IPVS Service for the given service. | [
"ipvsService",
"returns",
"an",
"IPVS",
"Service",
"for",
"the",
"given",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L110-L136 |
26,508 | google/seesaw | engine/vserver.go | ipvsEqual | func (s *service) ipvsEqual(other *service) bool {
return s.ipvsSvc.Equal(*other.ipvsSvc) &&
s.ventry.Mode == other.ventry.Mode &&
s.ventry.LThreshold == other.ventry.LThreshold &&
s.ventry.UThreshold == other.ventry.UThreshold
} | go | func (s *service) ipvsEqual(other *service) bool {
return s.ipvsSvc.Equal(*other.ipvsSvc) &&
s.ventry.Mode == other.ventry.Mode &&
s.ventry.LThreshold == other.ventry.LThreshold &&
s.ventry.UThreshold == other.ventry.UThreshold
} | [
"func",
"(",
"s",
"*",
"service",
")",
"ipvsEqual",
"(",
"other",
"*",
"service",
")",
"bool",
"{",
"return",
"s",
".",
"ipvsSvc",
".",
"Equal",
"(",
"*",
"other",
".",
"ipvsSvc",
")",
"&&",
"s",
".",
"ventry",
".",
"Mode",
"==",
"other",
".",
"v... | // ipvsEqual returns true if two services have the same IPVS configuration.
// Transient state and the services' destinations are ignored. | [
"ipvsEqual",
"returns",
"true",
"if",
"two",
"services",
"have",
"the",
"same",
"IPVS",
"configuration",
".",
"Transient",
"state",
"and",
"the",
"services",
"destinations",
"are",
"ignored",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L140-L145 |
26,509 | google/seesaw | engine/vserver.go | String | func (s *service) String() string {
if s.fwm != 0 {
return fmt.Sprintf("%v/fwm:%d", s.ip, s.fwm)
}
ip := s.ip.String()
port := strconv.Itoa(int(s.port))
return fmt.Sprintf("%v/%v", net.JoinHostPort(ip, port), s.proto)
} | go | func (s *service) String() string {
if s.fwm != 0 {
return fmt.Sprintf("%v/fwm:%d", s.ip, s.fwm)
}
ip := s.ip.String()
port := strconv.Itoa(int(s.port))
return fmt.Sprintf("%v/%v", net.JoinHostPort(ip, port), s.proto)
} | [
"func",
"(",
"s",
"*",
"service",
")",
"String",
"(",
")",
"string",
"{",
"if",
"s",
".",
"fwm",
"!=",
"0",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"ip",
",",
"s",
".",
"fwm",
")",
"\n",
"}",
"\n",
"ip",
":=",
... | // String returns a string representing a service. | [
"String",
"returns",
"a",
"string",
"representing",
"a",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L148-L155 |
26,510 | google/seesaw | engine/vserver.go | ipvsDestination | func (dst *destination) ipvsDestination() *ipvs.Destination {
var flags ipvs.DestinationFlags
switch dst.service.ventry.Mode {
case seesaw.LBModeNone:
log.Warningf("%v: Unspecified LB mode", dst)
case seesaw.LBModeDSR:
flags |= ipvs.DFForwardRoute
case seesaw.LBModeNAT:
flags |= ipvs.DFForwardMasq
}
return... | go | func (dst *destination) ipvsDestination() *ipvs.Destination {
var flags ipvs.DestinationFlags
switch dst.service.ventry.Mode {
case seesaw.LBModeNone:
log.Warningf("%v: Unspecified LB mode", dst)
case seesaw.LBModeDSR:
flags |= ipvs.DFForwardRoute
case seesaw.LBModeNAT:
flags |= ipvs.DFForwardMasq
}
return... | [
"func",
"(",
"dst",
"*",
"destination",
")",
"ipvsDestination",
"(",
")",
"*",
"ipvs",
".",
"Destination",
"{",
"var",
"flags",
"ipvs",
".",
"DestinationFlags",
"\n",
"switch",
"dst",
".",
"service",
".",
"ventry",
".",
"Mode",
"{",
"case",
"seesaw",
"."... | // ipvsDestination returns an IPVS Destination for the given destination. | [
"ipvsDestination",
"returns",
"an",
"IPVS",
"Destination",
"for",
"the",
"given",
"destination",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L181-L199 |
26,511 | google/seesaw | engine/vserver.go | ipvsEqual | func (d *destination) ipvsEqual(other *destination) bool {
return d.ipvsDst.Equal(*other.ipvsDst)
} | go | func (d *destination) ipvsEqual(other *destination) bool {
return d.ipvsDst.Equal(*other.ipvsDst)
} | [
"func",
"(",
"d",
"*",
"destination",
")",
"ipvsEqual",
"(",
"other",
"*",
"destination",
")",
"bool",
"{",
"return",
"d",
".",
"ipvsDst",
".",
"Equal",
"(",
"*",
"other",
".",
"ipvsDst",
")",
"\n",
"}"
] | // ipvsEqual returns true if two destinations have the same IPVS configuration.
// Transient state is ignored. | [
"ipvsEqual",
"returns",
"true",
"if",
"two",
"destinations",
"have",
"the",
"same",
"IPVS",
"configuration",
".",
"Transient",
"state",
"is",
"ignored",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L203-L205 |
26,512 | google/seesaw | engine/vserver.go | String | func (d *destination) String() string {
if d.service.fwm != 0 {
return fmt.Sprintf("%v", d.ip)
}
ip := d.ip.String()
port := strconv.Itoa(int(d.service.port))
return fmt.Sprintf("%v/%v", net.JoinHostPort(ip, port), d.service.proto)
} | go | func (d *destination) String() string {
if d.service.fwm != 0 {
return fmt.Sprintf("%v", d.ip)
}
ip := d.ip.String()
port := strconv.Itoa(int(d.service.port))
return fmt.Sprintf("%v/%v", net.JoinHostPort(ip, port), d.service.proto)
} | [
"func",
"(",
"d",
"*",
"destination",
")",
"String",
"(",
")",
"string",
"{",
"if",
"d",
".",
"service",
".",
"fwm",
"!=",
"0",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"d",
".",
"ip",
")",
"\n",
"}",
"\n",
"ip",
":=",
"d",... | // String returns a string representing a destination. | [
"String",
"returns",
"a",
"string",
"representing",
"a",
"destination",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L208-L215 |
26,513 | google/seesaw | engine/vserver.go | name | func (d *destination) name() string {
return fmt.Sprintf("%v/%v", d.service.vserver.String(), d.String())
} | go | func (d *destination) name() string {
return fmt.Sprintf("%v/%v", d.service.vserver.String(), d.String())
} | [
"func",
"(",
"d",
"*",
"destination",
")",
"name",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"d",
".",
"service",
".",
"vserver",
".",
"String",
"(",
")",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // name returns the name of a destination. | [
"name",
"returns",
"the",
"name",
"of",
"a",
"destination",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L218-L220 |
26,514 | google/seesaw | engine/vserver.go | newCheckKey | func newCheckKey(vip, bip seesaw.IP, port uint16, proto seesaw.IPProto, h *config.Healthcheck) checkKey {
return checkKey{
vserverIP: vip,
backendIP: bip,
servicePort: port,
serviceProtocol: proto,
healthcheckMode: h.Mode,
healthcheckType: h.Type,
healthcheckPort: h.Port,
name: ... | go | func newCheckKey(vip, bip seesaw.IP, port uint16, proto seesaw.IPProto, h *config.Healthcheck) checkKey {
return checkKey{
vserverIP: vip,
backendIP: bip,
servicePort: port,
serviceProtocol: proto,
healthcheckMode: h.Mode,
healthcheckType: h.Type,
healthcheckPort: h.Port,
name: ... | [
"func",
"newCheckKey",
"(",
"vip",
",",
"bip",
"seesaw",
".",
"IP",
",",
"port",
"uint16",
",",
"proto",
"seesaw",
".",
"IPProto",
",",
"h",
"*",
"config",
".",
"Healthcheck",
")",
"checkKey",
"{",
"return",
"checkKey",
"{",
"vserverIP",
":",
"vip",
",... | // newCheckKey returns an initialised checkKey. | [
"newCheckKey",
"returns",
"an",
"initialised",
"checkKey",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L235-L246 |
26,515 | google/seesaw | engine/vserver.go | String | func (c checkKey) String() string {
return fmt.Sprintf("%v:%d/%v backend %v:%d/%v %v %v port %d (%s)",
c.vserverIP, c.servicePort, c.serviceProtocol,
c.backendIP, c.servicePort, c.serviceProtocol,
c.healthcheckMode, c.healthcheckType, c.healthcheckPort, c.name)
} | go | func (c checkKey) String() string {
return fmt.Sprintf("%v:%d/%v backend %v:%d/%v %v %v port %d (%s)",
c.vserverIP, c.servicePort, c.serviceProtocol,
c.backendIP, c.servicePort, c.serviceProtocol,
c.healthcheckMode, c.healthcheckType, c.healthcheckPort, c.name)
} | [
"func",
"(",
"c",
"checkKey",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"vserverIP",
",",
"c",
".",
"servicePort",
",",
"c",
".",
"serviceProtocol",
",",
"c",
".",
"backendIP",
",",
"c"... | // String returns the string representation of a checkKey. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"a",
"checkKey",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L249-L254 |
26,516 | google/seesaw | engine/vserver.go | newCheck | func newCheck(key checkKey, v *vserver, h *config.Healthcheck) *check {
return &check{
key: key,
vserver: v,
healthcheck: h,
}
} | go | func newCheck(key checkKey, v *vserver, h *config.Healthcheck) *check {
return &check{
key: key,
vserver: v,
healthcheck: h,
}
} | [
"func",
"newCheck",
"(",
"key",
"checkKey",
",",
"v",
"*",
"vserver",
",",
"h",
"*",
"config",
".",
"Healthcheck",
")",
"*",
"check",
"{",
"return",
"&",
"check",
"{",
"key",
":",
"key",
",",
"vserver",
":",
"v",
",",
"healthcheck",
":",
"h",
",",
... | // newCheck returns an initialised check. | [
"newCheck",
"returns",
"an",
"initialised",
"check",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L267-L273 |
26,517 | google/seesaw | engine/vserver.go | expandServices | func (v *vserver) expandServices() map[serviceKey]*service {
if v.config.UseFWM {
return v.expandFWMServices()
}
svcs := make(map[serviceKey]*service)
for _, af := range seesaw.AFs() {
var ip net.IP
switch af {
case seesaw.IPv4:
ip = v.config.Host.IPv4Addr
case seesaw.IPv6:
ip = v.config.Host.IPv6A... | go | func (v *vserver) expandServices() map[serviceKey]*service {
if v.config.UseFWM {
return v.expandFWMServices()
}
svcs := make(map[serviceKey]*service)
for _, af := range seesaw.AFs() {
var ip net.IP
switch af {
case seesaw.IPv4:
ip = v.config.Host.IPv4Addr
case seesaw.IPv6:
ip = v.config.Host.IPv6A... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"expandServices",
"(",
")",
"map",
"[",
"serviceKey",
"]",
"*",
"service",
"{",
"if",
"v",
".",
"config",
".",
"UseFWM",
"{",
"return",
"v",
".",
"expandFWMServices",
"(",
")",
"\n",
"}",
"\n\n",
"svcs",
":=",
... | // expandServices returns a list of services that have been expanded from the
// vserver configuration. | [
"expandServices",
"returns",
"a",
"list",
"of",
"services",
"that",
"have",
"been",
"expanded",
"from",
"the",
"vserver",
"configuration",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L290-L325 |
26,518 | google/seesaw | engine/vserver.go | expandFWMServices | func (v *vserver) expandFWMServices() map[serviceKey]*service {
svcs := make(map[serviceKey]*service)
for _, af := range seesaw.AFs() {
var ip net.IP
switch af {
case seesaw.IPv4:
ip = v.config.Host.IPv4Addr
case seesaw.IPv6:
ip = v.config.Host.IPv6Addr
}
if ip == nil {
continue
}
// Persist... | go | func (v *vserver) expandFWMServices() map[serviceKey]*service {
svcs := make(map[serviceKey]*service)
for _, af := range seesaw.AFs() {
var ip net.IP
switch af {
case seesaw.IPv4:
ip = v.config.Host.IPv4Addr
case seesaw.IPv6:
ip = v.config.Host.IPv6Addr
}
if ip == nil {
continue
}
// Persist... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"expandFWMServices",
"(",
")",
"map",
"[",
"serviceKey",
"]",
"*",
"service",
"{",
"svcs",
":=",
"make",
"(",
"map",
"[",
"serviceKey",
"]",
"*",
"service",
")",
"\n",
"for",
"_",
",",
"af",
":=",
"range",
"se... | // expandFWMServices returns a list of services that have been expanded from the
// vserver configuration for a firewall mark based vserver. | [
"expandFWMServices",
"returns",
"a",
"list",
"of",
"services",
"that",
"have",
"been",
"expanded",
"from",
"the",
"vserver",
"configuration",
"for",
"a",
"firewall",
"mark",
"based",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L329-L373 |
26,519 | google/seesaw | engine/vserver.go | expandDests | func (v *vserver) expandDests(svc *service) map[destinationKey]*destination {
dsts := make(map[destinationKey]*destination, len(v.config.Backends))
for _, backend := range v.config.Backends {
var ip net.IP
switch svc.af {
case seesaw.IPv4:
ip = backend.Host.IPv4Addr
case seesaw.IPv6:
ip = backend.Host.I... | go | func (v *vserver) expandDests(svc *service) map[destinationKey]*destination {
dsts := make(map[destinationKey]*destination, len(v.config.Backends))
for _, backend := range v.config.Backends {
var ip net.IP
switch svc.af {
case seesaw.IPv4:
ip = backend.Host.IPv4Addr
case seesaw.IPv6:
ip = backend.Host.I... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"expandDests",
"(",
"svc",
"*",
"service",
")",
"map",
"[",
"destinationKey",
"]",
"*",
"destination",
"{",
"dsts",
":=",
"make",
"(",
"map",
"[",
"destinationKey",
"]",
"*",
"destination",
",",
"len",
"(",
"v",
... | // expandDests returns a list of destinations that have been expanded from the
// vserver configuration and a given service. | [
"expandDests",
"returns",
"a",
"list",
"of",
"destinations",
"that",
"have",
"been",
"expanded",
"from",
"the",
"vserver",
"configuration",
"and",
"a",
"given",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L377-L401 |
26,520 | google/seesaw | engine/vserver.go | expandChecks | func (v *vserver) expandChecks() map[checkKey]*check {
checks := make(map[checkKey]*check)
for _, svc := range v.services {
for _, dest := range svc.dests {
dest.checks = make([]*check, 0)
if !dest.backend.Enabled {
continue
}
for _, hc := range v.config.Healthchecks {
// vserver-level healthche... | go | func (v *vserver) expandChecks() map[checkKey]*check {
checks := make(map[checkKey]*check)
for _, svc := range v.services {
for _, dest := range svc.dests {
dest.checks = make([]*check, 0)
if !dest.backend.Enabled {
continue
}
for _, hc := range v.config.Healthchecks {
// vserver-level healthche... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"expandChecks",
"(",
")",
"map",
"[",
"checkKey",
"]",
"*",
"check",
"{",
"checks",
":=",
"make",
"(",
"map",
"[",
"checkKey",
"]",
"*",
"check",
")",
"\n",
"for",
"_",
",",
"svc",
":=",
"range",
"v",
".",
... | // expandChecks returns a list of checks that have been expanded from the
// vserver configuration. | [
"expandChecks",
"returns",
"a",
"list",
"of",
"checks",
"that",
"have",
"been",
"expanded",
"from",
"the",
"vserver",
"configuration",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L405-L448 |
26,521 | google/seesaw | engine/vserver.go | healthchecks | func (v *vserver) healthchecks() vserverChecks {
vc := vserverChecks{vserverName: v.config.Name}
if v.enabled {
vc.checks = v.checks
}
return vc
} | go | func (v *vserver) healthchecks() vserverChecks {
vc := vserverChecks{vserverName: v.config.Name}
if v.enabled {
vc.checks = v.checks
}
return vc
} | [
"func",
"(",
"v",
"*",
"vserver",
")",
"healthchecks",
"(",
")",
"vserverChecks",
"{",
"vc",
":=",
"vserverChecks",
"{",
"vserverName",
":",
"v",
".",
"config",
".",
"Name",
"}",
"\n",
"if",
"v",
".",
"enabled",
"{",
"vc",
".",
"checks",
"=",
"v",
... | // healthchecks returns the vserverChecks for a vserver. | [
"healthchecks",
"returns",
"the",
"vserverChecks",
"for",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L451-L457 |
26,522 | google/seesaw | engine/vserver.go | run | func (v *vserver) run() {
statsTicker := time.NewTicker(v.engine.config.StatsInterval)
for {
select {
case <-v.quit:
// Shutdown active vservers, services and destinations.
// There is no race between this and new healthcheck
// notifications, since they are also handled via the
// same vserver go rou... | go | func (v *vserver) run() {
statsTicker := time.NewTicker(v.engine.config.StatsInterval)
for {
select {
case <-v.quit:
// Shutdown active vservers, services and destinations.
// There is no race between this and new healthcheck
// notifications, since they are also handled via the
// same vserver go rou... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"run",
"(",
")",
"{",
"statsTicker",
":=",
"time",
".",
"NewTicker",
"(",
"v",
".",
"engine",
".",
"config",
".",
"StatsInterval",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"v",
".",
"quit",
":",
"... | // run invokes a vserver. This is a long-lived Go routine that lasts for the
// duration of the vserver, reacting to configuration changes and healthcheck
// notifications. | [
"run",
"invokes",
"a",
"vserver",
".",
"This",
"is",
"a",
"long",
"-",
"lived",
"Go",
"routine",
"that",
"lasts",
"for",
"the",
"duration",
"of",
"the",
"vserver",
"reacting",
"to",
"configuration",
"changes",
"and",
"healthcheck",
"notifications",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L462-L512 |
26,523 | google/seesaw | engine/vserver.go | handleConfigUpdate | func (v *vserver) handleConfigUpdate(config *config.Vserver) {
if config == nil {
return
}
switch {
case v.config == nil:
v.configInit(config)
return
case v.enabled && !vserverEnabled(config, v.vserverOverride.State()):
log.Infof("%v: disabling vserver", v)
v.downAll()
v.unconfigureVIPs()
v.configIn... | go | func (v *vserver) handleConfigUpdate(config *config.Vserver) {
if config == nil {
return
}
switch {
case v.config == nil:
v.configInit(config)
return
case v.enabled && !vserverEnabled(config, v.vserverOverride.State()):
log.Infof("%v: disabling vserver", v)
v.downAll()
v.unconfigureVIPs()
v.configIn... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"handleConfigUpdate",
"(",
"config",
"*",
"config",
".",
"Vserver",
")",
"{",
"if",
"config",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"switch",
"{",
"case",
"v",
".",
"config",
"==",
"nil",
":",
"v",
".",... | // handleConfigUpdate updates the internal structures of a vserver using the
// new configuration. | [
"handleConfigUpdate",
"updates",
"the",
"internal",
"structures",
"of",
"a",
"vserver",
"using",
"the",
"new",
"configuration",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L543-L611 |
26,524 | google/seesaw | engine/vserver.go | configInit | func (v *vserver) configInit(config *config.Vserver) {
v.config = config
v.enabled = vserverEnabled(config, v.vserverOverride.State())
newSvcs := v.expandServices()
// Preserve stats if this is a reinit
for svcK, svc := range newSvcs {
svc.dests = v.expandDests(svc)
if oldSvc, ok := v.services[svcK]; ok {
*... | go | func (v *vserver) configInit(config *config.Vserver) {
v.config = config
v.enabled = vserverEnabled(config, v.vserverOverride.State())
newSvcs := v.expandServices()
// Preserve stats if this is a reinit
for svcK, svc := range newSvcs {
svc.dests = v.expandDests(svc)
if oldSvc, ok := v.services[svcK]; ok {
*... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"configInit",
"(",
"config",
"*",
"config",
".",
"Vserver",
")",
"{",
"v",
".",
"config",
"=",
"config",
"\n",
"v",
".",
"enabled",
"=",
"vserverEnabled",
"(",
"config",
",",
"v",
".",
"vserverOverride",
".",
"S... | // configInit initialises all services, destinations, healthchecks and VIPs for
// a vserver. | [
"configInit",
"initialises",
"all",
"services",
"destinations",
"healthchecks",
"and",
"VIPs",
"for",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L615-L637 |
26,525 | google/seesaw | engine/vserver.go | configUpdate | func (v *vserver) configUpdate() {
newSvcs := v.expandServices()
for svcKey, newSvc := range newSvcs {
if svc, ok := v.services[svcKey]; ok {
if svc.ip.Equal(newSvc.ip) {
svc.update(newSvc)
continue
}
log.Infof("%v: service %v: new IP address: %v", v, svc, newSvc.ip)
v.deleteService(svc)
}
l... | go | func (v *vserver) configUpdate() {
newSvcs := v.expandServices()
for svcKey, newSvc := range newSvcs {
if svc, ok := v.services[svcKey]; ok {
if svc.ip.Equal(newSvc.ip) {
svc.update(newSvc)
continue
}
log.Infof("%v: service %v: new IP address: %v", v, svc, newSvc.ip)
v.deleteService(svc)
}
l... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"configUpdate",
"(",
")",
"{",
"newSvcs",
":=",
"v",
".",
"expandServices",
"(",
")",
"\n",
"for",
"svcKey",
",",
"newSvc",
":=",
"range",
"newSvcs",
"{",
"if",
"svc",
",",
"ok",
":=",
"v",
".",
"services",
"[... | // configUpdate updates the services, destinations, checks, and VIPs for a
// vserver. | [
"configUpdate",
"updates",
"the",
"services",
"destinations",
"checks",
"and",
"VIPs",
"for",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L641-L712 |
26,526 | google/seesaw | engine/vserver.go | deleteService | func (v *vserver) deleteService(s *service) {
if s.active {
s.healthy = false
v.updateState(s.ip)
}
log.Infof("%v: deleting service: %v", v, s)
delete(v.services, s.serviceKey)
// TODO(baptr): Once service contains seesaw.VIP, move check and
// unconfigureVIP here.
} | go | func (v *vserver) deleteService(s *service) {
if s.active {
s.healthy = false
v.updateState(s.ip)
}
log.Infof("%v: deleting service: %v", v, s)
delete(v.services, s.serviceKey)
// TODO(baptr): Once service contains seesaw.VIP, move check and
// unconfigureVIP here.
} | [
"func",
"(",
"v",
"*",
"vserver",
")",
"deleteService",
"(",
"s",
"*",
"service",
")",
"{",
"if",
"s",
".",
"active",
"{",
"s",
".",
"healthy",
"=",
"false",
"\n",
"v",
".",
"updateState",
"(",
"s",
".",
"ip",
")",
"\n",
"}",
"\n",
"log",
".",
... | // deleteService deletes a service for a vserver. | [
"deleteService",
"deletes",
"a",
"service",
"for",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L715-L724 |
26,527 | google/seesaw | engine/vserver.go | handleCheckNotification | func (v *vserver) handleCheckNotification(n *checkNotification) {
if !v.enabled {
log.Infof("%v: ignoring healthcheck notification %s (vserver disabled)", v, n.description)
return
}
check := v.checks[n.key]
if check == nil {
log.Warningf("%v: unknown check key %v", v, n.key)
return
}
transition := (chec... | go | func (v *vserver) handleCheckNotification(n *checkNotification) {
if !v.enabled {
log.Infof("%v: ignoring healthcheck notification %s (vserver disabled)", v, n.description)
return
}
check := v.checks[n.key]
if check == nil {
log.Warningf("%v: unknown check key %v", v, n.key)
return
}
transition := (chec... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"handleCheckNotification",
"(",
"n",
"*",
"checkNotification",
")",
"{",
"if",
"!",
"v",
".",
"enabled",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"v",
",",
"n",
".",
"description",
")",
"\n",
"return",
... | // handleCheckNotification processes a checkNotification, bringing
// destinations, services, and vservers up or down appropriately. | [
"handleCheckNotification",
"processes",
"a",
"checkNotification",
"bringing",
"destinations",
"services",
"and",
"vservers",
"up",
"or",
"down",
"appropriately",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L728-L749 |
26,528 | google/seesaw | engine/vserver.go | handleOverride | func (v *vserver) handleOverride(o seesaw.Override) {
switch override := o.(type) {
case *seesaw.VserverOverride:
if v.vserverOverride == *override {
// No change
return
}
v.vserverOverride = *override
if vserverEnabled(v.config, o.State()) == v.enabled {
// enable state not changed - nothing to do
... | go | func (v *vserver) handleOverride(o seesaw.Override) {
switch override := o.(type) {
case *seesaw.VserverOverride:
if v.vserverOverride == *override {
// No change
return
}
v.vserverOverride = *override
if vserverEnabled(v.config, o.State()) == v.enabled {
// enable state not changed - nothing to do
... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"handleOverride",
"(",
"o",
"seesaw",
".",
"Override",
")",
"{",
"switch",
"override",
":=",
"o",
".",
"(",
"type",
")",
"{",
"case",
"*",
"seesaw",
".",
"VserverOverride",
":",
"if",
"v",
".",
"vserverOverride",
... | // handleOverride processes an Override. | [
"handleOverride",
"processes",
"an",
"Override",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L752-L771 |
26,529 | google/seesaw | engine/vserver.go | vserverEnabled | func vserverEnabled(config *config.Vserver, os seesaw.OverrideState) bool {
switch {
case config == nil:
return false
case os == seesaw.OverrideDisable:
return false
case os == seesaw.OverrideEnable:
return true
}
return config.Enabled
} | go | func vserverEnabled(config *config.Vserver, os seesaw.OverrideState) bool {
switch {
case config == nil:
return false
case os == seesaw.OverrideDisable:
return false
case os == seesaw.OverrideEnable:
return true
}
return config.Enabled
} | [
"func",
"vserverEnabled",
"(",
"config",
"*",
"config",
".",
"Vserver",
",",
"os",
"seesaw",
".",
"OverrideState",
")",
"bool",
"{",
"switch",
"{",
"case",
"config",
"==",
"nil",
":",
"return",
"false",
"\n",
"case",
"os",
"==",
"seesaw",
".",
"OverrideD... | // vserverEnabled returns true if a vserver having the given configuration
// and override state should be enabled. | [
"vserverEnabled",
"returns",
"true",
"if",
"a",
"vserver",
"having",
"the",
"given",
"configuration",
"and",
"override",
"state",
"should",
"be",
"enabled",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L775-L785 |
26,530 | google/seesaw | engine/vserver.go | snapshot | func (v *vserver) snapshot() *seesaw.Vserver {
if v.config == nil {
return nil
}
sv := &seesaw.Vserver{
Name: v.config.Name,
Entries: make([]*seesaw.VserverEntry, 0, len(v.config.Entries)),
Host: seesaw.Host{
Hostname: v.config.Hostname,
IPv4Addr: v.config.IPv4Addr,
IPv4Mask: v.config.IPv4Mask,
... | go | func (v *vserver) snapshot() *seesaw.Vserver {
if v.config == nil {
return nil
}
sv := &seesaw.Vserver{
Name: v.config.Name,
Entries: make([]*seesaw.VserverEntry, 0, len(v.config.Entries)),
Host: seesaw.Host{
Hostname: v.config.Hostname,
IPv4Addr: v.config.IPv4Addr,
IPv4Mask: v.config.IPv4Mask,
... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"snapshot",
"(",
")",
"*",
"seesaw",
".",
"Vserver",
"{",
"if",
"v",
".",
"config",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"sv",
":=",
"&",
"seesaw",
".",
"Vserver",
"{",
"Name",
":",
"v",
"."... | // snapshot exports the current running state of the vserver. | [
"snapshot",
"exports",
"the",
"current",
"running",
"state",
"of",
"the",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L788-L819 |
26,531 | google/seesaw | engine/vserver.go | updateState | func (d *destination) updateState() {
// The destination is healthy if the backend is enabled and *all* the checks
// for that destination are healthy.
healthy := d.backend.Enabled
if healthy {
for _, c := range d.checks {
if c.status.State != healthcheck.StateHealthy {
healthy = false
break
}
}
... | go | func (d *destination) updateState() {
// The destination is healthy if the backend is enabled and *all* the checks
// for that destination are healthy.
healthy := d.backend.Enabled
if healthy {
for _, c := range d.checks {
if c.status.State != healthcheck.StateHealthy {
healthy = false
break
}
}
... | [
"func",
"(",
"d",
"*",
"destination",
")",
"updateState",
"(",
")",
"{",
"// The destination is healthy if the backend is enabled and *all* the checks",
"// for that destination are healthy.",
"healthy",
":=",
"d",
".",
"backend",
".",
"Enabled",
"\n",
"if",
"healthy",
"{... | // updateState updates the state of a destination based on the state of checks
// and propagates state changes to the service level if necessary. | [
"updateState",
"updates",
"the",
"state",
"of",
"a",
"destination",
"based",
"on",
"the",
"state",
"of",
"checks",
"and",
"propagates",
"state",
"changes",
"to",
"the",
"service",
"level",
"if",
"necessary",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L823-L851 |
26,532 | google/seesaw | engine/vserver.go | up | func (d *destination) up() {
d.active = true
log.Infof("%v: %v backend %v up", d.service.vserver, d.service, d)
ncc := d.service.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", d.service.vserver, err)
}
defer ncc.Close()
if err := ncc.IPVSAddDestination(d.service.... | go | func (d *destination) up() {
d.active = true
log.Infof("%v: %v backend %v up", d.service.vserver, d.service, d)
ncc := d.service.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", d.service.vserver, err)
}
defer ncc.Close()
if err := ncc.IPVSAddDestination(d.service.... | [
"func",
"(",
"d",
"*",
"destination",
")",
"up",
"(",
")",
"{",
"d",
".",
"active",
"=",
"true",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"d",
".",
"service",
".",
"vserver",
",",
"d",
".",
"service",
",",
"d",
")",
"\n\n",
"ncc",
":=... | // up brings up a destination. | [
"up",
"brings",
"up",
"a",
"destination",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L854-L866 |
26,533 | google/seesaw | engine/vserver.go | down | func (d *destination) down() {
d.active = false
log.Infof("%v: %v backend %v down", d.service.vserver, d.service, d)
ncc := d.service.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", d.service.vserver, err)
}
defer ncc.Close()
if err := ncc.IPVSDeleteDestination(d.... | go | func (d *destination) down() {
d.active = false
log.Infof("%v: %v backend %v down", d.service.vserver, d.service, d)
ncc := d.service.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", d.service.vserver, err)
}
defer ncc.Close()
if err := ncc.IPVSDeleteDestination(d.... | [
"func",
"(",
"d",
"*",
"destination",
")",
"down",
"(",
")",
"{",
"d",
".",
"active",
"=",
"false",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"d",
".",
"service",
".",
"vserver",
",",
"d",
".",
"service",
",",
"d",
")",
"\n\n",
"ncc",
... | // down takes down a destination. | [
"down",
"takes",
"down",
"a",
"destination",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L869-L881 |
26,534 | google/seesaw | engine/vserver.go | update | func (d *destination) update(dest *destination) {
if d.destinationKey != dest.destinationKey {
log.Fatalf("%v: can't update destination %v using %v: destinationKey mismatch: %v != %v",
d.service.vserver, d, dest, d.destinationKey, dest.destinationKey)
}
log.Infof("%v: %v updating destination %v", d.service.vser... | go | func (d *destination) update(dest *destination) {
if d.destinationKey != dest.destinationKey {
log.Fatalf("%v: can't update destination %v using %v: destinationKey mismatch: %v != %v",
d.service.vserver, d, dest, d.destinationKey, dest.destinationKey)
}
log.Infof("%v: %v updating destination %v", d.service.vser... | [
"func",
"(",
"d",
"*",
"destination",
")",
"update",
"(",
"dest",
"*",
"destination",
")",
"{",
"if",
"d",
".",
"destinationKey",
"!=",
"dest",
".",
"destinationKey",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"d",
".",
"service",
".",
"vserver... | // update updates a destination while preserving its running state. | [
"update",
"updates",
"a",
"destination",
"while",
"preserving",
"its",
"running",
"state",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L884-L923 |
26,535 | google/seesaw | engine/vserver.go | snapshot | func (d *destination) snapshot() *seesaw.Destination {
return &seesaw.Destination{
Backend: d.backend,
Name: d.name(),
VserverName: d.service.vserver.String(),
Stats: d.stats,
Enabled: d.backend.Enabled,
Weight: d.weight,
Healthy: d.healthy,
Active: d.active,
}
} | go | func (d *destination) snapshot() *seesaw.Destination {
return &seesaw.Destination{
Backend: d.backend,
Name: d.name(),
VserverName: d.service.vserver.String(),
Stats: d.stats,
Enabled: d.backend.Enabled,
Weight: d.weight,
Healthy: d.healthy,
Active: d.active,
}
} | [
"func",
"(",
"d",
"*",
"destination",
")",
"snapshot",
"(",
")",
"*",
"seesaw",
".",
"Destination",
"{",
"return",
"&",
"seesaw",
".",
"Destination",
"{",
"Backend",
":",
"d",
".",
"backend",
",",
"Name",
":",
"d",
".",
"name",
"(",
")",
",",
"Vser... | // snapshot exports the current running state of a destination. | [
"snapshot",
"exports",
"the",
"current",
"running",
"state",
"of",
"a",
"destination",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L926-L937 |
26,536 | google/seesaw | engine/vserver.go | updateState | func (s *service) updateState() {
// The service is considered healthy if:
// 1) No watermarks are configured, and at least one destination is healthy.
// OR
// 2) (Num healthy dests) / (Num backends) >= high watermark.
// OR
// 3) Service is already healthy, and
// (Num healthy dests) / (Num backends) >= low... | go | func (s *service) updateState() {
// The service is considered healthy if:
// 1) No watermarks are configured, and at least one destination is healthy.
// OR
// 2) (Num healthy dests) / (Num backends) >= high watermark.
// OR
// 3) Service is already healthy, and
// (Num healthy dests) / (Num backends) >= low... | [
"func",
"(",
"s",
"*",
"service",
")",
"updateState",
"(",
")",
"{",
"// The service is considered healthy if:",
"// 1) No watermarks are configured, and at least one destination is healthy.",
"// OR",
"// 2) (Num healthy dests) / (Num backends) >= high watermark.",
"// OR",
"// 3) Ser... | // updateState updates the state of a service based on the state of its
// destinations and propagates state changes to the vserver level if necessary. | [
"updateState",
"updates",
"the",
"state",
"of",
"a",
"service",
"based",
"on",
"the",
"state",
"of",
"its",
"destinations",
"and",
"propagates",
"state",
"changes",
"to",
"the",
"vserver",
"level",
"if",
"necessary",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L941-L1005 |
26,537 | google/seesaw | engine/vserver.go | updateDests | func (s *service) updateDests() {
for _, d := range s.dests {
if !s.active {
d.stats.DestinationStats = &ipvs.DestinationStats{}
if d.active {
d.down()
}
continue
}
switch {
case !d.healthy && d.active:
d.down()
case d.healthy && !d.active:
d.up()
}
}
} | go | func (s *service) updateDests() {
for _, d := range s.dests {
if !s.active {
d.stats.DestinationStats = &ipvs.DestinationStats{}
if d.active {
d.down()
}
continue
}
switch {
case !d.healthy && d.active:
d.down()
case d.healthy && !d.active:
d.up()
}
}
} | [
"func",
"(",
"s",
"*",
"service",
")",
"updateDests",
"(",
")",
"{",
"for",
"_",
",",
"d",
":=",
"range",
"s",
".",
"dests",
"{",
"if",
"!",
"s",
".",
"active",
"{",
"d",
".",
"stats",
".",
"DestinationStats",
"=",
"&",
"ipvs",
".",
"DestinationS... | // updateDests brings the destinations for a service up or down based on the
// state of the service and the health of each destination. | [
"updateDests",
"brings",
"the",
"destinations",
"for",
"a",
"service",
"up",
"or",
"down",
"based",
"on",
"the",
"state",
"of",
"the",
"service",
"and",
"the",
"health",
"of",
"each",
"destination",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1009-L1025 |
26,538 | google/seesaw | engine/vserver.go | up | func (s *service) up() {
s.active = true
log.Infof("%v: %v service up", s.vserver, s)
ncc := s.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", s.vserver, err)
}
defer ncc.Close()
log.Infof("%v: adding IPVS service %v", s.vserver, s.ipvsSvc)
if err := ncc.IPVSAdd... | go | func (s *service) up() {
s.active = true
log.Infof("%v: %v service up", s.vserver, s)
ncc := s.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", s.vserver, err)
}
defer ncc.Close()
log.Infof("%v: adding IPVS service %v", s.vserver, s.ipvsSvc)
if err := ncc.IPVSAdd... | [
"func",
"(",
"s",
"*",
"service",
")",
"up",
"(",
")",
"{",
"s",
".",
"active",
"=",
"true",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"s",
".",
"vserver",
",",
"s",
")",
"\n\n",
"ncc",
":=",
"s",
".",
"vserver",
".",
"ncc",
"\n",
"i... | // up brings up a service and all healthy destinations. | [
"up",
"brings",
"up",
"a",
"service",
"and",
"all",
"healthy",
"destinations",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1028-L1045 |
26,539 | google/seesaw | engine/vserver.go | down | func (s *service) down() {
s.active = false
s.stats.ServiceStats = &ipvs.ServiceStats{}
log.Infof("%v: %v service down", s.vserver, s)
ncc := s.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", s.vserver, err)
}
defer ncc.Close()
// Remove IPVS destinations *befor... | go | func (s *service) down() {
s.active = false
s.stats.ServiceStats = &ipvs.ServiceStats{}
log.Infof("%v: %v service down", s.vserver, s)
ncc := s.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", s.vserver, err)
}
defer ncc.Close()
// Remove IPVS destinations *befor... | [
"func",
"(",
"s",
"*",
"service",
")",
"down",
"(",
")",
"{",
"s",
".",
"active",
"=",
"false",
"\n",
"s",
".",
"stats",
".",
"ServiceStats",
"=",
"&",
"ipvs",
".",
"ServiceStats",
"{",
"}",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"s",... | // down takes down all destinations for a service, then takes down the
// service. | [
"down",
"takes",
"down",
"all",
"destinations",
"for",
"a",
"service",
"then",
"takes",
"down",
"the",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1049-L1066 |
26,540 | google/seesaw | engine/vserver.go | update | func (s *service) update(svc *service) {
if s.serviceKey != svc.serviceKey {
log.Fatalf("%v: can't update service %v using %v: serviceKey mismatch: %v != %v",
s.vserver, s, svc, s.serviceKey, svc.serviceKey)
}
log.Infof("%v: updating service %v", s.vserver, s)
updateIPVS := s.active && !s.ipvsEqual(svc)
svc.... | go | func (s *service) update(svc *service) {
if s.serviceKey != svc.serviceKey {
log.Fatalf("%v: can't update service %v using %v: serviceKey mismatch: %v != %v",
s.vserver, s, svc, s.serviceKey, svc.serviceKey)
}
log.Infof("%v: updating service %v", s.vserver, s)
updateIPVS := s.active && !s.ipvsEqual(svc)
svc.... | [
"func",
"(",
"s",
"*",
"service",
")",
"update",
"(",
"svc",
"*",
"service",
")",
"{",
"if",
"s",
".",
"serviceKey",
"!=",
"svc",
".",
"serviceKey",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"s",
".",
"vserver",
",",
"s",
",",
"svc",
","... | // update updates a service while preserving its running state. | [
"update",
"updates",
"a",
"service",
"while",
"preserving",
"its",
"running",
"state",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1069-L1097 |
26,541 | google/seesaw | engine/vserver.go | updateStats | func (s *service) updateStats() {
if !s.active {
return
}
log.V(1).Infof("%v: updating IPVS statistics for %v", s.vserver, s)
ncc := s.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", s.vserver, err)
}
defer ncc.Close()
ipvsSvc, err := ncc.IPVSGetService(s.ipvs... | go | func (s *service) updateStats() {
if !s.active {
return
}
log.V(1).Infof("%v: updating IPVS statistics for %v", s.vserver, s)
ncc := s.vserver.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", s.vserver, err)
}
defer ncc.Close()
ipvsSvc, err := ncc.IPVSGetService(s.ipvs... | [
"func",
"(",
"s",
"*",
"service",
")",
"updateStats",
"(",
")",
"{",
"if",
"!",
"s",
".",
"active",
"{",
"return",
"\n",
"}",
"\n",
"log",
".",
"V",
"(",
"1",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"s",
".",
"vserver",
",",
"s",
")",
"\n\... | // updateStats updates the IPVS statistics for this service. | [
"updateStats",
"updates",
"the",
"IPVS",
"statistics",
"for",
"this",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1100-L1133 |
26,542 | google/seesaw | engine/vserver.go | snapshot | func (s *service) snapshot() *seesaw.Service {
ss := &seesaw.Service{
ServiceKey: seesaw.ServiceKey{
AF: s.af,
Proto: s.proto,
Port: s.port,
},
Mode: s.ventry.Mode,
Scheduler: s.ventry.Scheduler,
OnePacket: s.ventry.OnePacket,
Persistence: s.ventry.Persistence,
IP: ... | go | func (s *service) snapshot() *seesaw.Service {
ss := &seesaw.Service{
ServiceKey: seesaw.ServiceKey{
AF: s.af,
Proto: s.proto,
Port: s.port,
},
Mode: s.ventry.Mode,
Scheduler: s.ventry.Scheduler,
OnePacket: s.ventry.OnePacket,
Persistence: s.ventry.Persistence,
IP: ... | [
"func",
"(",
"s",
"*",
"service",
")",
"snapshot",
"(",
")",
"*",
"seesaw",
".",
"Service",
"{",
"ss",
":=",
"&",
"seesaw",
".",
"Service",
"{",
"ServiceKey",
":",
"seesaw",
".",
"ServiceKey",
"{",
"AF",
":",
"s",
".",
"af",
",",
"Proto",
":",
"s... | // snapshot exports the current running state of a service. | [
"snapshot",
"exports",
"the",
"current",
"running",
"state",
"of",
"a",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1136-L1176 |
26,543 | google/seesaw | engine/vserver.go | updateState | func (v *vserver) updateState(ip seesaw.IP) {
// A vserver anycast IP is healthy if *all* services for that IP are healthy.
// A vserver unicast IP is healthy if *any* services for that IP are healthy.
var healthy bool
for _, s := range v.services {
if !s.ip.Equal(ip) {
continue
}
healthy = s.healthy
if ... | go | func (v *vserver) updateState(ip seesaw.IP) {
// A vserver anycast IP is healthy if *all* services for that IP are healthy.
// A vserver unicast IP is healthy if *any* services for that IP are healthy.
var healthy bool
for _, s := range v.services {
if !s.ip.Equal(ip) {
continue
}
healthy = s.healthy
if ... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"updateState",
"(",
"ip",
"seesaw",
".",
"IP",
")",
"{",
"// A vserver anycast IP is healthy if *all* services for that IP are healthy.",
"// A vserver unicast IP is healthy if *any* services for that IP are healthy.",
"var",
"healthy",
"boo... | // updateState updates the state of an IP for a vserver based on the state of
// that IP's services. | [
"updateState",
"updates",
"the",
"state",
"of",
"an",
"IP",
"for",
"a",
"vserver",
"based",
"on",
"the",
"state",
"of",
"that",
"IP",
"s",
"services",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1180-L1207 |
26,544 | google/seesaw | engine/vserver.go | updateServices | func (v *vserver) updateServices(ip seesaw.IP) {
for _, s := range v.services {
if !s.ip.Equal(ip) {
continue
}
if !v.active[ip] {
if s.active {
s.down()
}
continue
}
switch {
case !s.healthy && s.active:
s.down()
case s.healthy && !s.active:
s.up()
}
}
} | go | func (v *vserver) updateServices(ip seesaw.IP) {
for _, s := range v.services {
if !s.ip.Equal(ip) {
continue
}
if !v.active[ip] {
if s.active {
s.down()
}
continue
}
switch {
case !s.healthy && s.active:
s.down()
case s.healthy && !s.active:
s.up()
}
}
} | [
"func",
"(",
"v",
"*",
"vserver",
")",
"updateServices",
"(",
"ip",
"seesaw",
".",
"IP",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"v",
".",
"services",
"{",
"if",
"!",
"s",
".",
"ip",
".",
"Equal",
"(",
"ip",
")",
"{",
"continue",
"\n",
... | // updateServices brings the services for a vserver up or down based on the
// state of the vserver and the health of each service. | [
"updateServices",
"brings",
"the",
"services",
"for",
"a",
"vserver",
"up",
"or",
"down",
"based",
"on",
"the",
"state",
"of",
"the",
"vserver",
"and",
"the",
"health",
"of",
"each",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1211-L1229 |
26,545 | google/seesaw | engine/vserver.go | up | func (v *vserver) up(ip seesaw.IP) {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
v.active[ip] = true
v.updateServices(ip)
// If this is an anycast VIP, start advertising a BGP route.
nip := ip.IP()
if seesaw.IsAnycast(nip... | go | func (v *vserver) up(ip seesaw.IP) {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
v.active[ip] = true
v.updateServices(ip)
// If this is an anycast VIP, start advertising a BGP route.
nip := ip.IP()
if seesaw.IsAnycast(nip... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"up",
"(",
"ip",
"seesaw",
".",
"IP",
")",
"{",
"ncc",
":=",
"v",
".",
"engine",
".",
"ncc",
"\n",
"if",
"err",
":=",
"ncc",
".",
"Dial",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"... | // up brings up all healthy services for an IP address for a vserver, then
// brings up the IP address. | [
"up",
"brings",
"up",
"all",
"healthy",
"services",
"for",
"an",
"IP",
"address",
"for",
"a",
"vserver",
"then",
"brings",
"up",
"the",
"IP",
"address",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1233-L1274 |
26,546 | google/seesaw | engine/vserver.go | downAll | func (v *vserver) downAll() {
for _, s := range v.services {
if v.active[s.ip] {
v.down(s.ip)
}
if s.active {
s.down()
}
}
} | go | func (v *vserver) downAll() {
for _, s := range v.services {
if v.active[s.ip] {
v.down(s.ip)
}
if s.active {
s.down()
}
}
} | [
"func",
"(",
"v",
"*",
"vserver",
")",
"downAll",
"(",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"v",
".",
"services",
"{",
"if",
"v",
".",
"active",
"[",
"s",
".",
"ip",
"]",
"{",
"v",
".",
"down",
"(",
"s",
".",
"ip",
")",
"\n",
"}... | // downAll takes down all IP addresses and services for a vserver. | [
"downAll",
"takes",
"down",
"all",
"IP",
"addresses",
"and",
"services",
"for",
"a",
"vserver",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1277-L1286 |
26,547 | google/seesaw | engine/vserver.go | down | func (v *vserver) down(ip seesaw.IP) {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
// If this is an anycast VIP, withdraw the BGP route.
nip := ip.IP()
if seesaw.IsAnycast(nip) {
if v.engine.config.AnycastEnabled {
log.... | go | func (v *vserver) down(ip seesaw.IP) {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
// If this is an anycast VIP, withdraw the BGP route.
nip := ip.IP()
if seesaw.IsAnycast(nip) {
if v.engine.config.AnycastEnabled {
log.... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"down",
"(",
"ip",
"seesaw",
".",
"IP",
")",
"{",
"ncc",
":=",
"v",
".",
"engine",
".",
"ncc",
"\n",
"if",
"err",
":=",
"ncc",
".",
"Dial",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
... | // down takes down an IP address for a vserver, then takes down all services
// for that IP address. | [
"down",
"takes",
"down",
"an",
"IP",
"address",
"for",
"a",
"vserver",
"then",
"takes",
"down",
"all",
"services",
"for",
"that",
"IP",
"address",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1290-L1320 |
26,548 | google/seesaw | engine/vserver.go | configureVIPs | func (v *vserver) configureVIPs() {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
// TODO(ncope): Return to iterating over v.services once they contain seesaw.VIPs.
for _, vip := range v.config.VIPs {
if _, ok := v.vips[*vip]... | go | func (v *vserver) configureVIPs() {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
// TODO(ncope): Return to iterating over v.services once they contain seesaw.VIPs.
for _, vip := range v.config.VIPs {
if _, ok := v.vips[*vip]... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"configureVIPs",
"(",
")",
"{",
"ncc",
":=",
"v",
".",
"engine",
".",
"ncc",
"\n",
"if",
"err",
":=",
"ncc",
".",
"Dial",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",... | // configureVIPs configures VIPs on the load balancing interface. | [
"configureVIPs",
"configures",
"VIPs",
"on",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1330-L1363 |
26,549 | google/seesaw | engine/vserver.go | unconfigureVIP | func (v *vserver) unconfigureVIP(vip *seesaw.VIP) {
configured, ok := v.vips[*vip]
if !ok {
return
}
if configured {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
if err := v.engine.lbInterface.DeleteVIP(vip); err !=... | go | func (v *vserver) unconfigureVIP(vip *seesaw.VIP) {
configured, ok := v.vips[*vip]
if !ok {
return
}
if configured {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
if err := v.engine.lbInterface.DeleteVIP(vip); err !=... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"unconfigureVIP",
"(",
"vip",
"*",
"seesaw",
".",
"VIP",
")",
"{",
"configured",
",",
"ok",
":=",
"v",
".",
"vips",
"[",
"*",
"vip",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"if",
"confi... | // unconfigureVIP removes a unicast VIP from the load balancing interface. | [
"unconfigureVIP",
"removes",
"a",
"unicast",
"VIP",
"from",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1366-L1387 |
26,550 | google/seesaw | engine/vserver.go | unconfigureVIPs | func (v *vserver) unconfigureVIPs() {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
// TODO(jsing): At a later date this will need to support VLAN
// interfaces and dedicated VIP subnets.
for vip := range v.vips {
v.unconfig... | go | func (v *vserver) unconfigureVIPs() {
ncc := v.engine.ncc
if err := ncc.Dial(); err != nil {
log.Fatalf("%v: failed to connect to NCC: %v", v, err)
}
defer ncc.Close()
// TODO(jsing): At a later date this will need to support VLAN
// interfaces and dedicated VIP subnets.
for vip := range v.vips {
v.unconfig... | [
"func",
"(",
"v",
"*",
"vserver",
")",
"unconfigureVIPs",
"(",
")",
"{",
"ncc",
":=",
"v",
".",
"engine",
".",
"ncc",
"\n",
"if",
"err",
":=",
"ncc",
".",
"Dial",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
... | // unconfigureVIPs removes unicast VIPs from the load balancing interface. | [
"unconfigureVIPs",
"removes",
"unicast",
"VIPs",
"from",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/vserver.go#L1390-L1402 |
26,551 | google/seesaw | engine/config/fetcher.go | fetchFromHost | func (f *fetcher) fetchFromHost(ip net.IP, url, contentType string) ([]byte, error) {
// TODO(angusc): connection timeout?
tcpAddr := &net.TCPAddr{IP: ip, Port: f.port}
tcpConn, err := net.DialTCP("tcp", nil, tcpAddr)
if err != nil {
return nil, err
}
defer tcpConn.Close()
tcpConn.SetDeadline(time.Now().Add(f.... | go | func (f *fetcher) fetchFromHost(ip net.IP, url, contentType string) ([]byte, error) {
// TODO(angusc): connection timeout?
tcpAddr := &net.TCPAddr{IP: ip, Port: f.port}
tcpConn, err := net.DialTCP("tcp", nil, tcpAddr)
if err != nil {
return nil, err
}
defer tcpConn.Close()
tcpConn.SetDeadline(time.Now().Add(f.... | [
"func",
"(",
"f",
"*",
"fetcher",
")",
"fetchFromHost",
"(",
"ip",
"net",
".",
"IP",
",",
"url",
",",
"contentType",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// TODO(angusc): connection timeout?",
"tcpAddr",
":=",
"&",
"net",
".",
... | // fetchFromHost attempts to fetch the specified URL from a specific host. | [
"fetchFromHost",
"attempts",
"to",
"fetch",
"the",
"specified",
"URL",
"from",
"a",
"specific",
"host",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/config/fetcher.go#L86-L130 |
26,552 | google/seesaw | netlink/netlink.go | uint16FromNetwork | func uint16FromNetwork(u uint16) uint16 {
b := *(*[2]byte)(unsafe.Pointer(&u))
return binary.BigEndian.Uint16(b[:])
} | go | func uint16FromNetwork(u uint16) uint16 {
b := *(*[2]byte)(unsafe.Pointer(&u))
return binary.BigEndian.Uint16(b[:])
} | [
"func",
"uint16FromNetwork",
"(",
"u",
"uint16",
")",
"uint16",
"{",
"b",
":=",
"*",
"(",
"*",
"[",
"2",
"]",
"byte",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"u",
")",
")",
"\n",
"return",
"binary",
".",
"BigEndian",
".",
"Uint16",
"(",
"b"... | // uint16FromNetwork converts the given value from its network byte order. | [
"uint16FromNetwork",
"converts",
"the",
"given",
"value",
"from",
"its",
"network",
"byte",
"order",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L48-L51 |
26,553 | google/seesaw | netlink/netlink.go | uint16ToNetwork | func uint16ToNetwork(u uint16) uint16 {
var b [2]byte
binary.BigEndian.PutUint16(b[:], u)
return *(*uint16)(unsafe.Pointer(&b))
} | go | func uint16ToNetwork(u uint16) uint16 {
var b [2]byte
binary.BigEndian.PutUint16(b[:], u)
return *(*uint16)(unsafe.Pointer(&b))
} | [
"func",
"uint16ToNetwork",
"(",
"u",
"uint16",
")",
"uint16",
"{",
"var",
"b",
"[",
"2",
"]",
"byte",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint16",
"(",
"b",
"[",
":",
"]",
",",
"u",
")",
"\n",
"return",
"*",
"(",
"*",
"uint16",
")",
"(",
... | // uint16ToNetwork converts the given value to its network byte order. | [
"uint16ToNetwork",
"converts",
"the",
"given",
"value",
"to",
"its",
"network",
"byte",
"order",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L54-L58 |
26,554 | google/seesaw | netlink/netlink.go | uint32FromNetwork | func uint32FromNetwork(u uint32) uint32 {
b := *(*[4]byte)(unsafe.Pointer(&u))
return binary.BigEndian.Uint32(b[:])
} | go | func uint32FromNetwork(u uint32) uint32 {
b := *(*[4]byte)(unsafe.Pointer(&u))
return binary.BigEndian.Uint32(b[:])
} | [
"func",
"uint32FromNetwork",
"(",
"u",
"uint32",
")",
"uint32",
"{",
"b",
":=",
"*",
"(",
"*",
"[",
"4",
"]",
"byte",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"u",
")",
")",
"\n",
"return",
"binary",
".",
"BigEndian",
".",
"Uint32",
"(",
"b"... | // uint32FromNetwork converts the given value from its network byte order. | [
"uint32FromNetwork",
"converts",
"the",
"given",
"value",
"from",
"its",
"network",
"byte",
"order",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L61-L64 |
26,555 | google/seesaw | netlink/netlink.go | uint32ToNetwork | func uint32ToNetwork(u uint32) uint32 {
var b [4]byte
binary.BigEndian.PutUint32(b[:], u)
return *(*uint32)(unsafe.Pointer(&b))
} | go | func uint32ToNetwork(u uint32) uint32 {
var b [4]byte
binary.BigEndian.PutUint32(b[:], u)
return *(*uint32)(unsafe.Pointer(&b))
} | [
"func",
"uint32ToNetwork",
"(",
"u",
"uint32",
")",
"uint32",
"{",
"var",
"b",
"[",
"4",
"]",
"byte",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"b",
"[",
":",
"]",
",",
"u",
")",
"\n",
"return",
"*",
"(",
"*",
"uint32",
")",
"(",
... | // uint32ToNetwork converts the given value to its network byte order. | [
"uint32ToNetwork",
"converts",
"the",
"given",
"value",
"to",
"its",
"network",
"byte",
"order",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L67-L71 |
26,556 | google/seesaw | netlink/netlink.go | uint64FromNetwork | func uint64FromNetwork(u uint64) uint64 {
b := *(*[8]byte)(unsafe.Pointer(&u))
return binary.BigEndian.Uint64(b[:])
} | go | func uint64FromNetwork(u uint64) uint64 {
b := *(*[8]byte)(unsafe.Pointer(&u))
return binary.BigEndian.Uint64(b[:])
} | [
"func",
"uint64FromNetwork",
"(",
"u",
"uint64",
")",
"uint64",
"{",
"b",
":=",
"*",
"(",
"*",
"[",
"8",
"]",
"byte",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"u",
")",
")",
"\n",
"return",
"binary",
".",
"BigEndian",
".",
"Uint64",
"(",
"b"... | // uint64FromNetwork converts the given value from its network byte order. | [
"uint64FromNetwork",
"converts",
"the",
"given",
"value",
"from",
"its",
"network",
"byte",
"order",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L74-L77 |
26,557 | google/seesaw | netlink/netlink.go | uint64ToNetwork | func uint64ToNetwork(u uint64) uint64 {
var b [8]byte
binary.BigEndian.PutUint64(b[:], u)
return *(*uint64)(unsafe.Pointer(&b))
} | go | func uint64ToNetwork(u uint64) uint64 {
var b [8]byte
binary.BigEndian.PutUint64(b[:], u)
return *(*uint64)(unsafe.Pointer(&b))
} | [
"func",
"uint64ToNetwork",
"(",
"u",
"uint64",
")",
"uint64",
"{",
"var",
"b",
"[",
"8",
"]",
"byte",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint64",
"(",
"b",
"[",
":",
"]",
",",
"u",
")",
"\n",
"return",
"*",
"(",
"*",
"uint64",
")",
"(",
... | // uint64ToNetwork converts the given value to its network byte order. | [
"uint64ToNetwork",
"converts",
"the",
"given",
"value",
"to",
"its",
"network",
"byte",
"order",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L80-L84 |
26,558 | google/seesaw | netlink/netlink.go | structMaxAttrID | func structMaxAttrID(v reflect.Value) (uint16, error) {
if v.Kind() != reflect.Struct {
return 0, fmt.Errorf("%v is not a struct", v.Type())
}
st := v.Type()
var maxAttrID uint16
for i := 0; i < st.NumField(); i++ {
ft, fv := st.Field(i), v.Field(i)
fp, err := parseFieldParams(ft.Tag.Get("netlink"))
if er... | go | func structMaxAttrID(v reflect.Value) (uint16, error) {
if v.Kind() != reflect.Struct {
return 0, fmt.Errorf("%v is not a struct", v.Type())
}
st := v.Type()
var maxAttrID uint16
for i := 0; i < st.NumField(); i++ {
ft, fv := st.Field(i), v.Field(i)
fp, err := parseFieldParams(ft.Tag.Get("netlink"))
if er... | [
"func",
"structMaxAttrID",
"(",
"v",
"reflect",
".",
"Value",
")",
"(",
"uint16",
",",
"error",
")",
"{",
"if",
"v",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
... | // structMaxAttrID returns the maximum attribute ID found on netlink tagged
// fields within the given struct and any untagged structs it contains. | [
"structMaxAttrID",
"returns",
"the",
"maximum",
"attribute",
"ID",
"found",
"on",
"netlink",
"tagged",
"fields",
"within",
"the",
"given",
"struct",
"and",
"any",
"untagged",
"structs",
"it",
"contains",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L130-L157 |
26,559 | google/seesaw | netlink/netlink.go | Error | func (e *Error) Error() string {
nle := C.GoString(C.nl_geterror(e.errno))
return fmt.Sprintf("%s: %s", e.msg, strings.ToLower(nle))
} | go | func (e *Error) Error() string {
nle := C.GoString(C.nl_geterror(e.errno))
return fmt.Sprintf("%s: %s", e.msg, strings.ToLower(nle))
} | [
"func",
"(",
"e",
"*",
"Error",
")",
"Error",
"(",
")",
"string",
"{",
"nle",
":=",
"C",
".",
"GoString",
"(",
"C",
".",
"nl_geterror",
"(",
"e",
".",
"errno",
")",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"... | // Error returns the string representation of a netlink error. | [
"Error",
"returns",
"the",
"string",
"representation",
"of",
"a",
"netlink",
"error",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L539-L542 |
26,560 | google/seesaw | netlink/netlink.go | Family | func Family(name string) (int, error) {
s, err := newSocket()
if err != nil {
return -1, err
}
defer s.free()
if errno := C.genl_connect(s.nls); errno != 0 {
return -1, &Error{errno, "failed to connect to netlink"}
}
defer C.nl_close((*C.struct_nl_sock)(s.nls))
cn := C.CString(name)
defer C.free(unsafe.P... | go | func Family(name string) (int, error) {
s, err := newSocket()
if err != nil {
return -1, err
}
defer s.free()
if errno := C.genl_connect(s.nls); errno != 0 {
return -1, &Error{errno, "failed to connect to netlink"}
}
defer C.nl_close((*C.struct_nl_sock)(s.nls))
cn := C.CString(name)
defer C.free(unsafe.P... | [
"func",
"Family",
"(",
"name",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"newSocket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"defer",
"s",
".",
"free",
"... | // Family returns the family identifier for the specified family name. | [
"Family",
"returns",
"the",
"family",
"identifier",
"for",
"the",
"specified",
"family",
"name",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/netlink/netlink.go#L545-L564 |
26,561 | google/seesaw | ncc/ip.go | validateInterface | func validateInterface(iface *net.Interface) error {
if !ifaceNameRegexp.MatchString(iface.Name) {
return fmt.Errorf("Invalid interface name %q", iface.Name)
}
return nil
} | go | func validateInterface(iface *net.Interface) error {
if !ifaceNameRegexp.MatchString(iface.Name) {
return fmt.Errorf("Invalid interface name %q", iface.Name)
}
return nil
} | [
"func",
"validateInterface",
"(",
"iface",
"*",
"net",
".",
"Interface",
")",
"error",
"{",
"if",
"!",
"ifaceNameRegexp",
".",
"MatchString",
"(",
"iface",
".",
"Name",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"iface",
".",
"Name... | // validateInterface validates the name of a network interface. | [
"validateInterface",
"validates",
"the",
"name",
"of",
"a",
"network",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L45-L50 |
26,562 | google/seesaw | ncc/ip.go | ifaceDown | func ifaceDown(pIface *net.Interface) error {
out, err := ipRunOutput("link show dev %s", pIface.Name)
if !strings.Contains(out, "state UP") {
return nil
}
// Unlike IPv4, the kernel removes IPv6 addresses when the link goes down. We
// don't want that behavior, so we have to preserve the addresses manually.
/... | go | func ifaceDown(pIface *net.Interface) error {
out, err := ipRunOutput("link show dev %s", pIface.Name)
if !strings.Contains(out, "state UP") {
return nil
}
// Unlike IPv4, the kernel removes IPv6 addresses when the link goes down. We
// don't want that behavior, so we have to preserve the addresses manually.
/... | [
"func",
"ifaceDown",
"(",
"pIface",
"*",
"net",
".",
"Interface",
")",
"error",
"{",
"out",
",",
"err",
":=",
"ipRunOutput",
"(",
"\"",
"\"",
",",
"pIface",
".",
"Name",
")",
"\n",
"if",
"!",
"strings",
".",
"Contains",
"(",
"out",
",",
"\"",
"\"",... | // ifaceDown sets the interface link state to down and preserves IPv6 addresses
// for both the given interface and any associated VLAN interfaces. | [
"ifaceDown",
"sets",
"the",
"interface",
"link",
"state",
"to",
"down",
"and",
"preserves",
"IPv6",
"addresses",
"for",
"both",
"the",
"given",
"interface",
"and",
"any",
"associated",
"VLAN",
"interfaces",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L106-L139 |
26,563 | google/seesaw | ncc/ip.go | ifaceSetMAC | func ifaceSetMAC(iface *net.Interface) error {
return ipRunIface(iface, "link set %s address %s", iface.Name, iface.HardwareAddr)
} | go | func ifaceSetMAC(iface *net.Interface) error {
return ipRunIface(iface, "link set %s address %s", iface.Name, iface.HardwareAddr)
} | [
"func",
"ifaceSetMAC",
"(",
"iface",
"*",
"net",
".",
"Interface",
")",
"error",
"{",
"return",
"ipRunIface",
"(",
"iface",
",",
"\"",
"\"",
",",
"iface",
".",
"Name",
",",
"iface",
".",
"HardwareAddr",
")",
"\n",
"}"
] | // ifaceSetMAC sets the interface MAC address. | [
"ifaceSetMAC",
"sets",
"the",
"interface",
"MAC",
"address",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L153-L155 |
26,564 | google/seesaw | ncc/ip.go | ifaceAddIPAddr | func ifaceAddIPAddr(iface *net.Interface, ip net.IP, mask net.IPMask) error {
if ip.To4() != nil {
return ifaceAddIPv4Addr(iface, ip, mask)
}
return ifaceAddIPv6Addr(iface, ip, mask)
} | go | func ifaceAddIPAddr(iface *net.Interface, ip net.IP, mask net.IPMask) error {
if ip.To4() != nil {
return ifaceAddIPv4Addr(iface, ip, mask)
}
return ifaceAddIPv6Addr(iface, ip, mask)
} | [
"func",
"ifaceAddIPAddr",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"ip",
"net",
".",
"IP",
",",
"mask",
"net",
".",
"IPMask",
")",
"error",
"{",
"if",
"ip",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"return",
"ifaceAddIPv4Addr",
"(",
"iface",
... | // ifaceAddIPAddr adds the given IP address to the network interface. | [
"ifaceAddIPAddr",
"adds",
"the",
"given",
"IP",
"address",
"to",
"the",
"network",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L158-L163 |
26,565 | google/seesaw | ncc/ip.go | ifaceAddIPv4Addr | func ifaceAddIPv4Addr(iface *net.Interface, ip net.IP, mask net.IPMask) error {
if ip.To4() == nil {
return fmt.Errorf("IP %v is not a valid IPv4 address", ip)
}
brd := make(net.IP, net.IPv4len)
copy(brd, ip.To4())
for i := 0; i < net.IPv4len; i++ {
brd[i] |= ^mask[i]
}
prefixLen, _ := mask.Size()
return ip... | go | func ifaceAddIPv4Addr(iface *net.Interface, ip net.IP, mask net.IPMask) error {
if ip.To4() == nil {
return fmt.Errorf("IP %v is not a valid IPv4 address", ip)
}
brd := make(net.IP, net.IPv4len)
copy(brd, ip.To4())
for i := 0; i < net.IPv4len; i++ {
brd[i] |= ^mask[i]
}
prefixLen, _ := mask.Size()
return ip... | [
"func",
"ifaceAddIPv4Addr",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"ip",
"net",
".",
"IP",
",",
"mask",
"net",
".",
"IPMask",
")",
"error",
"{",
"if",
"ip",
".",
"To4",
"(",
")",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\... | // ifaceAddIPv4Addr adds the given IPv4 address to the network interface. | [
"ifaceAddIPv4Addr",
"adds",
"the",
"given",
"IPv4",
"address",
"to",
"the",
"network",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L166-L177 |
26,566 | google/seesaw | ncc/ip.go | ifaceAddIPv6Addr | func ifaceAddIPv6Addr(iface *net.Interface, ip net.IP, mask net.IPMask) error {
prefixLen, _ := mask.Size()
return ipRunIface(iface, "addr add %s/%d dev %s", ip, prefixLen, iface.Name)
} | go | func ifaceAddIPv6Addr(iface *net.Interface, ip net.IP, mask net.IPMask) error {
prefixLen, _ := mask.Size()
return ipRunIface(iface, "addr add %s/%d dev %s", ip, prefixLen, iface.Name)
} | [
"func",
"ifaceAddIPv6Addr",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"ip",
"net",
".",
"IP",
",",
"mask",
"net",
".",
"IPMask",
")",
"error",
"{",
"prefixLen",
",",
"_",
":=",
"mask",
".",
"Size",
"(",
")",
"\n",
"return",
"ipRunIface",
"(",
... | // ifaceAddIPv6Addr adds the given IPv6 address to the network interface. | [
"ifaceAddIPv6Addr",
"adds",
"the",
"given",
"IPv6",
"address",
"to",
"the",
"network",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L180-L183 |
26,567 | google/seesaw | ncc/ip.go | ifaceAddVLAN | func ifaceAddVLAN(iface *net.Interface, vlan *seesaw.VLAN) error {
name := fmt.Sprintf("%s.%d", iface.Name, vlan.ID)
err := ipRunIface(iface, "link add link %s name %s type vlan id %d", iface.Name, name, vlan.ID)
if err != nil {
return fmt.Errorf("Failed to create VLAN interface %q: %v", name, err)
}
vlanIface,... | go | func ifaceAddVLAN(iface *net.Interface, vlan *seesaw.VLAN) error {
name := fmt.Sprintf("%s.%d", iface.Name, vlan.ID)
err := ipRunIface(iface, "link add link %s name %s type vlan id %d", iface.Name, name, vlan.ID)
if err != nil {
return fmt.Errorf("Failed to create VLAN interface %q: %v", name, err)
}
vlanIface,... | [
"func",
"ifaceAddVLAN",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"vlan",
"*",
"seesaw",
".",
"VLAN",
")",
"error",
"{",
"name",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"iface",
".",
"Name",
",",
"vlan",
".",
"ID",
")",
"\n",
"e... | // ifaceAddVLAN creates a new VLAN interface on the given physical interface. | [
"ifaceAddVLAN",
"creates",
"a",
"new",
"VLAN",
"interface",
"on",
"the",
"given",
"physical",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L197-L228 |
26,568 | google/seesaw | ncc/ip.go | ifaceDelVLAN | func ifaceDelVLAN(iface *net.Interface, vlan *seesaw.VLAN) error {
name := fmt.Sprintf("%s.%d", iface.Name, vlan.ID)
vlanIface, err := net.InterfaceByName(name)
if err != nil {
return fmt.Errorf("Failed to find VLAN interface %q: %v", name, err)
}
return ipRunIface(vlanIface, "link del dev %s", vlanIface.Name)
} | go | func ifaceDelVLAN(iface *net.Interface, vlan *seesaw.VLAN) error {
name := fmt.Sprintf("%s.%d", iface.Name, vlan.ID)
vlanIface, err := net.InterfaceByName(name)
if err != nil {
return fmt.Errorf("Failed to find VLAN interface %q: %v", name, err)
}
return ipRunIface(vlanIface, "link del dev %s", vlanIface.Name)
} | [
"func",
"ifaceDelVLAN",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"vlan",
"*",
"seesaw",
".",
"VLAN",
")",
"error",
"{",
"name",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"iface",
".",
"Name",
",",
"vlan",
".",
"ID",
")",
"\n",
"v... | // ifaceDelVLAN removes a VLAN interface from the given physical interface. | [
"ifaceDelVLAN",
"removes",
"a",
"VLAN",
"interface",
"from",
"the",
"given",
"physical",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L231-L238 |
26,569 | google/seesaw | ncc/ip.go | ifaceFlushVLANs | func ifaceFlushVLANs(iface *net.Interface) error {
if err := validateInterface(iface); err != nil {
return err
}
vlanIfaces, err := vlanInterfaces(iface)
if err != nil {
return err
}
for _, vlanIface := range vlanIfaces {
if err := ipRunIface(vlanIface, "link del dev %s", vlanIface.Name); err != nil {
re... | go | func ifaceFlushVLANs(iface *net.Interface) error {
if err := validateInterface(iface); err != nil {
return err
}
vlanIfaces, err := vlanInterfaces(iface)
if err != nil {
return err
}
for _, vlanIface := range vlanIfaces {
if err := ipRunIface(vlanIface, "link del dev %s", vlanIface.Name); err != nil {
re... | [
"func",
"ifaceFlushVLANs",
"(",
"iface",
"*",
"net",
".",
"Interface",
")",
"error",
"{",
"if",
"err",
":=",
"validateInterface",
"(",
"iface",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"vlanIfaces",
",",
"err",
":=",
"vlanIn... | // ifaceFlushVLANs removes all VLAN interfaces from the given physical
// interface. | [
"ifaceFlushVLANs",
"removes",
"all",
"VLAN",
"interfaces",
"from",
"the",
"given",
"physical",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L242-L256 |
26,570 | google/seesaw | ncc/ip.go | routeDefaultIPv4 | func routeDefaultIPv4() (net.IP, error) {
out, err := ipRunAFOutput(seesaw.IPv4, "route show default")
if err != nil {
return nil, err
}
if dr := routeDefaultIPv4Regexp.FindStringSubmatch(out); dr != nil {
return net.ParseIP(dr[1]).To4(), nil
}
return nil, fmt.Errorf("Default route not found")
} | go | func routeDefaultIPv4() (net.IP, error) {
out, err := ipRunAFOutput(seesaw.IPv4, "route show default")
if err != nil {
return nil, err
}
if dr := routeDefaultIPv4Regexp.FindStringSubmatch(out); dr != nil {
return net.ParseIP(dr[1]).To4(), nil
}
return nil, fmt.Errorf("Default route not found")
} | [
"func",
"routeDefaultIPv4",
"(",
")",
"(",
"net",
".",
"IP",
",",
"error",
")",
"{",
"out",
",",
"err",
":=",
"ipRunAFOutput",
"(",
"seesaw",
".",
"IPv4",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n... | // routeDefaultIPv4 returns the default route for IPv4 traffic. | [
"routeDefaultIPv4",
"returns",
"the",
"default",
"route",
"for",
"IPv4",
"traffic",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L259-L268 |
26,571 | google/seesaw | ncc/ip.go | removeRoutes | func removeRoutes(table string, vip net.IP) error {
af := seesaw.IPv6
if vip.To4() != nil {
af = seesaw.IPv4
}
return ipRunAF(af, "route flush table %s %s", table, vip)
} | go | func removeRoutes(table string, vip net.IP) error {
af := seesaw.IPv6
if vip.To4() != nil {
af = seesaw.IPv4
}
return ipRunAF(af, "route flush table %s %s", table, vip)
} | [
"func",
"removeRoutes",
"(",
"table",
"string",
",",
"vip",
"net",
".",
"IP",
")",
"error",
"{",
"af",
":=",
"seesaw",
".",
"IPv6",
"\n",
"if",
"vip",
".",
"To4",
"(",
")",
"!=",
"nil",
"{",
"af",
"=",
"seesaw",
".",
"IPv4",
"\n",
"}",
"\n",
"r... | // removeRoutes deletes the routing table entries for a VIP, from the specified
// table. | [
"removeRoutes",
"deletes",
"the",
"routing",
"table",
"entries",
"for",
"a",
"VIP",
"from",
"the",
"specified",
"table",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L272-L278 |
26,572 | google/seesaw | ncc/ip.go | routeLocal | func routeLocal(iface *net.Interface, vip net.IP, node seesaw.Host) error {
af := seesaw.IPv6
src := node.IPv6Addr
if vip.To4() != nil {
af = seesaw.IPv4
src = node.IPv4Addr
}
if err := removeLocalRoutes(vip); err != nil {
return err
}
return ipRunAF(af, "route add table local local %s dev %s src %s", vip,... | go | func routeLocal(iface *net.Interface, vip net.IP, node seesaw.Host) error {
af := seesaw.IPv6
src := node.IPv6Addr
if vip.To4() != nil {
af = seesaw.IPv4
src = node.IPv4Addr
}
if err := removeLocalRoutes(vip); err != nil {
return err
}
return ipRunAF(af, "route add table local local %s dev %s src %s", vip,... | [
"func",
"routeLocal",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"vip",
"net",
".",
"IP",
",",
"node",
"seesaw",
".",
"Host",
")",
"error",
"{",
"af",
":=",
"seesaw",
".",
"IPv6",
"\n",
"src",
":=",
"node",
".",
"IPv6Addr",
"\n",
"if",
"vip",... | // routeLocal removes all routes in the local routing table for the given VIP
// and adds new routes with the correct source address. | [
"routeLocal",
"removes",
"all",
"routes",
"in",
"the",
"local",
"routing",
"table",
"for",
"the",
"given",
"VIP",
"and",
"adds",
"new",
"routes",
"with",
"the",
"correct",
"source",
"address",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L292-L303 |
26,573 | google/seesaw | ncc/ip.go | RouteDefaultIPv4 | func (ncc *SeesawNCC) RouteDefaultIPv4(unused int, gateway *net.IP) error {
ip, err := routeDefaultIPv4()
if err != nil {
return err
}
if gateway != nil {
*gateway = make(net.IP, len(ip))
copy(*gateway, ip)
}
return nil
} | go | func (ncc *SeesawNCC) RouteDefaultIPv4(unused int, gateway *net.IP) error {
ip, err := routeDefaultIPv4()
if err != nil {
return err
}
if gateway != nil {
*gateway = make(net.IP, len(ip))
copy(*gateway, ip)
}
return nil
} | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"RouteDefaultIPv4",
"(",
"unused",
"int",
",",
"gateway",
"*",
"net",
".",
"IP",
")",
"error",
"{",
"ip",
",",
"err",
":=",
"routeDefaultIPv4",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",... | // RouteDefaultIPv4 returns the default route for IPv4 traffic. | [
"RouteDefaultIPv4",
"returns",
"the",
"default",
"route",
"for",
"IPv4",
"traffic",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ip.go#L306-L316 |
26,574 | google/seesaw | ncc/lb.go | addClusterVIP | func addClusterVIP(iface *ncctypes.LBInterface, netIface, nodeIface *net.Interface, clusterVIP net.IP) error {
nodeIP := iface.Node.IPv4Addr
family := seesaw.IPv4
if clusterVIP.To4() == nil {
nodeIP = iface.Node.IPv6Addr
family = seesaw.IPv6
}
if nodeIP == nil {
return fmt.Errorf("Node does not have an %s ad... | go | func addClusterVIP(iface *ncctypes.LBInterface, netIface, nodeIface *net.Interface, clusterVIP net.IP) error {
nodeIP := iface.Node.IPv4Addr
family := seesaw.IPv4
if clusterVIP.To4() == nil {
nodeIP = iface.Node.IPv6Addr
family = seesaw.IPv6
}
if nodeIP == nil {
return fmt.Errorf("Node does not have an %s ad... | [
"func",
"addClusterVIP",
"(",
"iface",
"*",
"ncctypes",
".",
"LBInterface",
",",
"netIface",
",",
"nodeIface",
"*",
"net",
".",
"Interface",
",",
"clusterVIP",
"net",
".",
"IP",
")",
"error",
"{",
"nodeIP",
":=",
"iface",
".",
"Node",
".",
"IPv4Addr",
"\... | // addClusterVIP adds a cluster VIP to the load balancing interface and
// performs additional network configuration. | [
"addClusterVIP",
"adds",
"a",
"cluster",
"VIP",
"to",
"the",
"load",
"balancing",
"interface",
"and",
"performs",
"additional",
"network",
"configuration",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L120-L171 |
26,575 | google/seesaw | ncc/lb.go | LBInterfaceDown | func (ncc *SeesawNCC) LBInterfaceDown(iface *ncctypes.LBInterface, out *int) error {
netIface, err := iface.Interface()
if err != nil {
return err
}
log.Infof("Bringing down LB interface %s", netIface.Name)
return ifaceDown(netIface)
} | go | func (ncc *SeesawNCC) LBInterfaceDown(iface *ncctypes.LBInterface, out *int) error {
netIface, err := iface.Interface()
if err != nil {
return err
}
log.Infof("Bringing down LB interface %s", netIface.Name)
return ifaceDown(netIface)
} | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceDown",
"(",
"iface",
"*",
"ncctypes",
".",
"LBInterface",
",",
"out",
"*",
"int",
")",
"error",
"{",
"netIface",
",",
"err",
":=",
"iface",
".",
"Interface",
"(",
")",
"\n",
"if",
"err",
"!=",
"n... | // LBInterfaceDown brings the load balancing interface down. | [
"LBInterfaceDown",
"brings",
"the",
"load",
"balancing",
"interface",
"down",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L174-L181 |
26,576 | google/seesaw | ncc/lb.go | LBInterfaceUp | func (ncc *SeesawNCC) LBInterfaceUp(iface *ncctypes.LBInterface, out *int) error {
// TODO(jsing): Handle IPv6-only, and improve IPv6 route setup.
netIface, err := iface.Interface()
if err != nil {
return err
}
nodeIface, err := net.InterfaceByName(iface.NodeInterface)
if err != nil {
return fmt.Errorf("Faile... | go | func (ncc *SeesawNCC) LBInterfaceUp(iface *ncctypes.LBInterface, out *int) error {
// TODO(jsing): Handle IPv6-only, and improve IPv6 route setup.
netIface, err := iface.Interface()
if err != nil {
return err
}
nodeIface, err := net.InterfaceByName(iface.NodeInterface)
if err != nil {
return fmt.Errorf("Faile... | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceUp",
"(",
"iface",
"*",
"ncctypes",
".",
"LBInterface",
",",
"out",
"*",
"int",
")",
"error",
"{",
"// TODO(jsing): Handle IPv6-only, and improve IPv6 route setup.",
"netIface",
",",
"err",
":=",
"iface",
".",... | // LBInterfaceUp brings the load balancing interface up. | [
"LBInterfaceUp",
"brings",
"the",
"load",
"balancing",
"interface",
"up",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L184-L223 |
26,577 | google/seesaw | ncc/lb.go | LBInterfaceAddVserver | func (ncc *SeesawNCC) LBInterfaceAddVserver(lbVserver *ncctypes.LBInterfaceVserver, out *int) error {
return iptablesAddRules(lbVserver.Vserver, lbVserver.Iface.ClusterVIP, lbVserver.AF)
} | go | func (ncc *SeesawNCC) LBInterfaceAddVserver(lbVserver *ncctypes.LBInterfaceVserver, out *int) error {
return iptablesAddRules(lbVserver.Vserver, lbVserver.Iface.ClusterVIP, lbVserver.AF)
} | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceAddVserver",
"(",
"lbVserver",
"*",
"ncctypes",
".",
"LBInterfaceVserver",
",",
"out",
"*",
"int",
")",
"error",
"{",
"return",
"iptablesAddRules",
"(",
"lbVserver",
".",
"Vserver",
",",
"lbVserver",
".",
... | // LBInterfaceAddVserver adds the specified Vserver to the load balancing interface. | [
"LBInterfaceAddVserver",
"adds",
"the",
"specified",
"Vserver",
"to",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L226-L228 |
26,578 | google/seesaw | ncc/lb.go | LBInterfaceDeleteVserver | func (ncc *SeesawNCC) LBInterfaceDeleteVserver(lbVserver *ncctypes.LBInterfaceVserver, out *int) error {
return iptablesDeleteRules(lbVserver.Vserver, lbVserver.Iface.ClusterVIP, lbVserver.AF)
} | go | func (ncc *SeesawNCC) LBInterfaceDeleteVserver(lbVserver *ncctypes.LBInterfaceVserver, out *int) error {
return iptablesDeleteRules(lbVserver.Vserver, lbVserver.Iface.ClusterVIP, lbVserver.AF)
} | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceDeleteVserver",
"(",
"lbVserver",
"*",
"ncctypes",
".",
"LBInterfaceVserver",
",",
"out",
"*",
"int",
")",
"error",
"{",
"return",
"iptablesDeleteRules",
"(",
"lbVserver",
".",
"Vserver",
",",
"lbVserver",
... | // LBInterfaceDeleteVserver removes the specified Vserver from the load balancing interface. | [
"LBInterfaceDeleteVserver",
"removes",
"the",
"specified",
"Vserver",
"from",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L231-L233 |
26,579 | google/seesaw | ncc/lb.go | LBInterfaceAddVIP | func (ncc *SeesawNCC) LBInterfaceAddVIP(vip *ncctypes.LBInterfaceVIP, out *int) error {
switch vip.Type {
case seesaw.UnicastVIP:
netIface, err := vip.Iface.Interface()
if err != nil {
return err
}
iface, network, err := selectInterfaceNetwork(netIface, vip.IP.IP())
if err != nil {
return fmt.Errorf("... | go | func (ncc *SeesawNCC) LBInterfaceAddVIP(vip *ncctypes.LBInterfaceVIP, out *int) error {
switch vip.Type {
case seesaw.UnicastVIP:
netIface, err := vip.Iface.Interface()
if err != nil {
return err
}
iface, network, err := selectInterfaceNetwork(netIface, vip.IP.IP())
if err != nil {
return fmt.Errorf("... | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceAddVIP",
"(",
"vip",
"*",
"ncctypes",
".",
"LBInterfaceVIP",
",",
"out",
"*",
"int",
")",
"error",
"{",
"switch",
"vip",
".",
"Type",
"{",
"case",
"seesaw",
".",
"UnicastVIP",
":",
"netIface",
",",
... | // LBInterfaceAddVIP adds the specified VIP to the load balancing interface. | [
"LBInterfaceAddVIP",
"adds",
"the",
"specified",
"VIP",
"to",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L236-L270 |
26,580 | google/seesaw | ncc/lb.go | LBInterfaceDeleteVIP | func (ncc *SeesawNCC) LBInterfaceDeleteVIP(vip *ncctypes.LBInterfaceVIP, out *int) error {
switch vip.Type {
case seesaw.UnicastVIP:
netIface, err := vip.Iface.Interface()
if err != nil {
return err
}
iface, network, err := findInterfaceNetwork(netIface, vip.IP.IP())
if err != nil {
return fmt.Errorf(... | go | func (ncc *SeesawNCC) LBInterfaceDeleteVIP(vip *ncctypes.LBInterfaceVIP, out *int) error {
switch vip.Type {
case seesaw.UnicastVIP:
netIface, err := vip.Iface.Interface()
if err != nil {
return err
}
iface, network, err := findInterfaceNetwork(netIface, vip.IP.IP())
if err != nil {
return fmt.Errorf(... | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceDeleteVIP",
"(",
"vip",
"*",
"ncctypes",
".",
"LBInterfaceVIP",
",",
"out",
"*",
"int",
")",
"error",
"{",
"switch",
"vip",
".",
"Type",
"{",
"case",
"seesaw",
".",
"UnicastVIP",
":",
"netIface",
","... | // LBInterfaceDeleteVIP removes the specified VIP from the load balancing
// interface. | [
"LBInterfaceDeleteVIP",
"removes",
"the",
"specified",
"VIP",
"from",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L274-L326 |
26,581 | google/seesaw | ncc/lb.go | LBInterfaceAddVLAN | func (ncc *SeesawNCC) LBInterfaceAddVLAN(vlan *ncctypes.LBInterfaceVLAN, out *int) error {
netIface, err := vlan.Iface.Interface()
if err != nil {
return err
}
return ifaceAddVLAN(netIface, vlan.VLAN)
} | go | func (ncc *SeesawNCC) LBInterfaceAddVLAN(vlan *ncctypes.LBInterfaceVLAN, out *int) error {
netIface, err := vlan.Iface.Interface()
if err != nil {
return err
}
return ifaceAddVLAN(netIface, vlan.VLAN)
} | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceAddVLAN",
"(",
"vlan",
"*",
"ncctypes",
".",
"LBInterfaceVLAN",
",",
"out",
"*",
"int",
")",
"error",
"{",
"netIface",
",",
"err",
":=",
"vlan",
".",
"Iface",
".",
"Interface",
"(",
")",
"\n",
"if"... | // LBInterfaceAddVLAN creates a VLAN interface on the load balancing interface. | [
"LBInterfaceAddVLAN",
"creates",
"a",
"VLAN",
"interface",
"on",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L329-L335 |
26,582 | google/seesaw | ncc/lb.go | LBInterfaceDeleteVLAN | func (ncc *SeesawNCC) LBInterfaceDeleteVLAN(vlan *ncctypes.LBInterfaceVLAN, out *int) error {
netIface, err := vlan.Iface.Interface()
if err != nil {
return err
}
return ifaceDelVLAN(netIface, vlan.VLAN)
} | go | func (ncc *SeesawNCC) LBInterfaceDeleteVLAN(vlan *ncctypes.LBInterfaceVLAN, out *int) error {
netIface, err := vlan.Iface.Interface()
if err != nil {
return err
}
return ifaceDelVLAN(netIface, vlan.VLAN)
} | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"LBInterfaceDeleteVLAN",
"(",
"vlan",
"*",
"ncctypes",
".",
"LBInterfaceVLAN",
",",
"out",
"*",
"int",
")",
"error",
"{",
"netIface",
",",
"err",
":=",
"vlan",
".",
"Iface",
".",
"Interface",
"(",
")",
"\n",
"... | // LBInterfaceDeleteVLAN deletes a VLAN interface from the load balancing interface. | [
"LBInterfaceDeleteVLAN",
"deletes",
"a",
"VLAN",
"interface",
"from",
"the",
"load",
"balancing",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L338-L344 |
26,583 | google/seesaw | ncc/lb.go | vlanInterfaces | func vlanInterfaces(pIface *net.Interface) ([]*net.Interface, error) {
allIfaces, err := net.Interfaces()
if err != nil {
return nil, err
}
ifaces := make([]*net.Interface, 0, len(allIfaces))
prefix := fmt.Sprintf("%s.", pIface.Name)
for i, iface := range allIfaces {
if strings.HasPrefix(iface.Name, prefix) {... | go | func vlanInterfaces(pIface *net.Interface) ([]*net.Interface, error) {
allIfaces, err := net.Interfaces()
if err != nil {
return nil, err
}
ifaces := make([]*net.Interface, 0, len(allIfaces))
prefix := fmt.Sprintf("%s.", pIface.Name)
for i, iface := range allIfaces {
if strings.HasPrefix(iface.Name, prefix) {... | [
"func",
"vlanInterfaces",
"(",
"pIface",
"*",
"net",
".",
"Interface",
")",
"(",
"[",
"]",
"*",
"net",
".",
"Interface",
",",
"error",
")",
"{",
"allIfaces",
",",
"err",
":=",
"net",
".",
"Interfaces",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // vlanInterfaces returns a slice containing the VLAN interfaces associated
// with a physical interface. | [
"vlanInterfaces",
"returns",
"a",
"slice",
"containing",
"the",
"VLAN",
"interfaces",
"associated",
"with",
"a",
"physical",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L348-L361 |
26,584 | google/seesaw | ncc/lb.go | findInterfaceNetwork | func findInterfaceNetwork(pIface *net.Interface, ip net.IP) (*net.Interface, *net.IPNet, error) {
ifaces, err := vlanInterfaces(pIface)
ifaces = append(ifaces, pIface)
if err != nil {
return nil, nil, err
}
for _, iface := range ifaces {
if network, _ := findNetwork(iface, ip); network != nil {
return iface... | go | func findInterfaceNetwork(pIface *net.Interface, ip net.IP) (*net.Interface, *net.IPNet, error) {
ifaces, err := vlanInterfaces(pIface)
ifaces = append(ifaces, pIface)
if err != nil {
return nil, nil, err
}
for _, iface := range ifaces {
if network, _ := findNetwork(iface, ip); network != nil {
return iface... | [
"func",
"findInterfaceNetwork",
"(",
"pIface",
"*",
"net",
".",
"Interface",
",",
"ip",
"net",
".",
"IP",
")",
"(",
"*",
"net",
".",
"Interface",
",",
"*",
"net",
".",
"IPNet",
",",
"error",
")",
"{",
"ifaces",
",",
"err",
":=",
"vlanInterfaces",
"("... | // findInterfaceNetwork searches for the given IP address on the given physical
// interface and its associated VLAN interfaces. If the address is not
// configured on any interface, an error is returned. | [
"findInterfaceNetwork",
"searches",
"for",
"the",
"given",
"IP",
"address",
"on",
"the",
"given",
"physical",
"interface",
"and",
"its",
"associated",
"VLAN",
"interfaces",
".",
"If",
"the",
"address",
"is",
"not",
"configured",
"on",
"any",
"interface",
"an",
... | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L366-L378 |
26,585 | google/seesaw | ncc/lb.go | findNetwork | func findNetwork(iface *net.Interface, ip net.IP) (*net.IPNet, error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, fmt.Errorf("Failed to get addresses for interface %q: %v", iface.Name, err)
}
for _, addr := range addrs {
ipStr := addr.String()
ipAddr, ipNet, err := net.ParseCIDR(ipStr)
if err ... | go | func findNetwork(iface *net.Interface, ip net.IP) (*net.IPNet, error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, fmt.Errorf("Failed to get addresses for interface %q: %v", iface.Name, err)
}
for _, addr := range addrs {
ipStr := addr.String()
ipAddr, ipNet, err := net.ParseCIDR(ipStr)
if err ... | [
"func",
"findNetwork",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"ip",
"net",
".",
"IP",
")",
"(",
"*",
"net",
".",
"IPNet",
",",
"error",
")",
"{",
"addrs",
",",
"err",
":=",
"iface",
".",
"Addrs",
"(",
")",
"\n",
"if",
"err",
"!=",
"ni... | // findNetwork returns the network for the given IP address on the given
// interface. If the address is not configured on the interface, an error is
// returned. | [
"findNetwork",
"returns",
"the",
"network",
"for",
"the",
"given",
"IP",
"address",
"on",
"the",
"given",
"interface",
".",
"If",
"the",
"address",
"is",
"not",
"configured",
"on",
"the",
"interface",
"an",
"error",
"is",
"returned",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/lb.go#L383-L399 |
26,586 | google/seesaw | watchdog/service.go | newService | func newService(name, binary string) *Service {
return &Service{
name: name,
binary: binary,
args: make([]string, 0),
dependencies: make(map[string]*Service),
dependents: make(map[string]*Service),
done: make(chan bool),
shutdown: make(chan bool, 1),
started: make(chan boo... | go | func newService(name, binary string) *Service {
return &Service{
name: name,
binary: binary,
args: make([]string, 0),
dependencies: make(map[string]*Service),
dependents: make(map[string]*Service),
done: make(chan bool),
shutdown: make(chan bool, 1),
started: make(chan boo... | [
"func",
"newService",
"(",
"name",
",",
"binary",
"string",
")",
"*",
"Service",
"{",
"return",
"&",
"Service",
"{",
"name",
":",
"name",
",",
"binary",
":",
"binary",
",",
"args",
":",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
",",
"dependen... | // newService returns an initialised service. | [
"newService",
"returns",
"an",
"initialised",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L70-L85 |
26,587 | google/seesaw | watchdog/service.go | AddArgs | func (svc *Service) AddArgs(args string) {
svc.args = strings.Fields(args)
} | go | func (svc *Service) AddArgs(args string) {
svc.args = strings.Fields(args)
} | [
"func",
"(",
"svc",
"*",
"Service",
")",
"AddArgs",
"(",
"args",
"string",
")",
"{",
"svc",
".",
"args",
"=",
"strings",
".",
"Fields",
"(",
"args",
")",
"\n",
"}"
] | // AddArgs adds the given string as arguments. | [
"AddArgs",
"adds",
"the",
"given",
"string",
"as",
"arguments",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L93-L95 |
26,588 | google/seesaw | watchdog/service.go | SetPriority | func (svc *Service) SetPriority(priority int) error {
if priority < -20 || priority > 19 {
return fmt.Errorf("Invalid priority %d - must be between -20 and 19", priority)
}
svc.priority = priority
return nil
} | go | func (svc *Service) SetPriority(priority int) error {
if priority < -20 || priority > 19 {
return fmt.Errorf("Invalid priority %d - must be between -20 and 19", priority)
}
svc.priority = priority
return nil
} | [
"func",
"(",
"svc",
"*",
"Service",
")",
"SetPriority",
"(",
"priority",
"int",
")",
"error",
"{",
"if",
"priority",
"<",
"-",
"20",
"||",
"priority",
">",
"19",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"priority",
")",
"\n",
"}",... | // SetPriority sets the process priority for a service. | [
"SetPriority",
"sets",
"the",
"process",
"priority",
"for",
"a",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L98-L104 |
26,589 | google/seesaw | watchdog/service.go | SetUser | func (svc *Service) SetUser(username string) error {
u, err := user.Lookup(username)
if err != nil {
return err
}
uid, err := strconv.Atoi(u.Uid)
if err != nil {
return err
}
gid, err := strconv.Atoi(u.Gid)
if err != nil {
return err
}
svc.uid = uint32(uid)
svc.gid = uint32(gid)
return nil
} | go | func (svc *Service) SetUser(username string) error {
u, err := user.Lookup(username)
if err != nil {
return err
}
uid, err := strconv.Atoi(u.Uid)
if err != nil {
return err
}
gid, err := strconv.Atoi(u.Gid)
if err != nil {
return err
}
svc.uid = uint32(uid)
svc.gid = uint32(gid)
return nil
} | [
"func",
"(",
"svc",
"*",
"Service",
")",
"SetUser",
"(",
"username",
"string",
")",
"error",
"{",
"u",
",",
"err",
":=",
"user",
".",
"Lookup",
"(",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"uid",
",... | // SetUser sets the user for a service. | [
"SetUser",
"sets",
"the",
"user",
"for",
"a",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L112-L128 |
26,590 | google/seesaw | watchdog/service.go | run | func (svc *Service) run() {
// Wait for dependencies to start.
for _, dep := range svc.dependencies {
log.Infof("Service %s waiting for %s to start", svc.name, dep.name)
select {
case started := <-dep.started:
dep.started <- started
case <-svc.shutdown:
goto done
}
}
for {
if svc.failures > 0 {
... | go | func (svc *Service) run() {
// Wait for dependencies to start.
for _, dep := range svc.dependencies {
log.Infof("Service %s waiting for %s to start", svc.name, dep.name)
select {
case started := <-dep.started:
dep.started <- started
case <-svc.shutdown:
goto done
}
}
for {
if svc.failures > 0 {
... | [
"func",
"(",
"svc",
"*",
"Service",
")",
"run",
"(",
")",
"{",
"// Wait for dependencies to start.",
"for",
"_",
",",
"dep",
":=",
"range",
"svc",
".",
"dependencies",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"svc",
".",
"name",
",",
"dep",
".... | // run runs a service and restarts it upon termination, unless a shutdown
// notification has been received. | [
"run",
"runs",
"a",
"service",
"and",
"restarts",
"it",
"upon",
"termination",
"unless",
"a",
"shutdown",
"notification",
"has",
"been",
"received",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L132-L173 |
26,591 | google/seesaw | watchdog/service.go | logFile | func (svc *Service) logFile() (*os.File, error) {
name := "seesaw_" + svc.name
t := time.Now()
logName := fmt.Sprintf("%s.log.%04d%02d%02d-%02d%02d%02d", name,
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())
f, err := os.Create(path.Join(logDir, logName))
if err != nil {
return nil, err
}
l... | go | func (svc *Service) logFile() (*os.File, error) {
name := "seesaw_" + svc.name
t := time.Now()
logName := fmt.Sprintf("%s.log.%04d%02d%02d-%02d%02d%02d", name,
t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())
f, err := os.Create(path.Join(logDir, logName))
if err != nil {
return nil, err
}
l... | [
"func",
"(",
"svc",
"*",
"Service",
")",
"logFile",
"(",
")",
"(",
"*",
"os",
".",
"File",
",",
"error",
")",
"{",
"name",
":=",
"\"",
"\"",
"+",
"svc",
".",
"name",
"\n",
"t",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"logName",
":=",
"fmt",... | // logFile creates a log file for this service. | [
"logFile",
"creates",
"a",
"log",
"file",
"for",
"this",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L176-L195 |
26,592 | google/seesaw | watchdog/service.go | logSink | func (svc *Service) logSink(f *os.File, r io.ReadCloser) {
_, err := io.Copy(f, r)
if err != nil {
log.Warningf("Service %s - log sink failed: %v", svc.name, err)
}
f.Close()
r.Close()
} | go | func (svc *Service) logSink(f *os.File, r io.ReadCloser) {
_, err := io.Copy(f, r)
if err != nil {
log.Warningf("Service %s - log sink failed: %v", svc.name, err)
}
f.Close()
r.Close()
} | [
"func",
"(",
"svc",
"*",
"Service",
")",
"logSink",
"(",
"f",
"*",
"os",
".",
"File",
",",
"r",
"io",
".",
"ReadCloser",
")",
"{",
"_",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"f",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log"... | // logSink copies output from the given reader to a log file, before closing
// both the reader and the log file. | [
"logSink",
"copies",
"output",
"from",
"the",
"given",
"reader",
"to",
"a",
"log",
"file",
"before",
"closing",
"both",
"the",
"reader",
"and",
"the",
"log",
"file",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L199-L206 |
26,593 | google/seesaw | watchdog/service.go | signal | func (svc *Service) signal(sig os.Signal) error {
svc.lock.Lock()
defer svc.lock.Unlock()
if svc.process == nil {
return nil
}
return svc.process.Signal(sig)
} | go | func (svc *Service) signal(sig os.Signal) error {
svc.lock.Lock()
defer svc.lock.Unlock()
if svc.process == nil {
return nil
}
return svc.process.Signal(sig)
} | [
"func",
"(",
"svc",
"*",
"Service",
")",
"signal",
"(",
"sig",
"os",
".",
"Signal",
")",
"error",
"{",
"svc",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"svc",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"svc",
".",
"process",
"==... | // signal sends a signal to the service. | [
"signal",
"sends",
"a",
"signal",
"to",
"the",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L298-L305 |
26,594 | google/seesaw | watchdog/service.go | stop | func (svc *Service) stop() {
// TODO(jsing): Check if it is actually running?
log.Infof("Stopping service %s...", svc.name)
// Wait for dependents to shutdown.
for _, dep := range svc.dependents {
log.Infof("Service %s waiting for %s to stop", svc.name, dep.name)
stopped := <-dep.stopped
dep.stopped <- stopp... | go | func (svc *Service) stop() {
// TODO(jsing): Check if it is actually running?
log.Infof("Stopping service %s...", svc.name)
// Wait for dependents to shutdown.
for _, dep := range svc.dependents {
log.Infof("Service %s waiting for %s to stop", svc.name, dep.name)
stopped := <-dep.stopped
dep.stopped <- stopp... | [
"func",
"(",
"svc",
"*",
"Service",
")",
"stop",
"(",
")",
"{",
"// TODO(jsing): Check if it is actually running?",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"svc",
".",
"name",
")",
"\n\n",
"// Wait for dependents to shutdown.",
"for",
"_",
",",
"dep",
":=",... | // stop stops a running service. | [
"stop",
"stops",
"a",
"running",
"service",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/service.go#L308-L329 |
26,595 | google/seesaw | ncc/arp.go | bytes | func (m *arpMessage) bytes() ([]byte, error) {
buf := new(bytes.Buffer)
if err := binary.Write(buf, binary.BigEndian, m.arpHeader); err != nil {
return nil, fmt.Errorf("binary write failed: %v", err)
}
buf.Write(m.senderHardwareAddress)
buf.Write(m.senderProtocolAddress)
buf.Write(m.targetHardwareAddress)
buf... | go | func (m *arpMessage) bytes() ([]byte, error) {
buf := new(bytes.Buffer)
if err := binary.Write(buf, binary.BigEndian, m.arpHeader); err != nil {
return nil, fmt.Errorf("binary write failed: %v", err)
}
buf.Write(m.senderHardwareAddress)
buf.Write(m.senderProtocolAddress)
buf.Write(m.targetHardwareAddress)
buf... | [
"func",
"(",
"m",
"*",
"arpMessage",
")",
"bytes",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"buf",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n\n",
"if",
"err",
":=",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",... | // bytes returns the wire representation of the ARP message. | [
"bytes",
"returns",
"the",
"wire",
"representation",
"of",
"the",
"ARP",
"message",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/arp.go#L70-L82 |
26,596 | google/seesaw | ncc/arp.go | gratuitousARPReply | func gratuitousARPReply(ip net.IP, mac net.HardwareAddr) (*arpMessage, error) {
if ip.To4() == nil {
return nil, fmt.Errorf("%q is not an IPv4 address", ip)
}
if len(mac) != hwLen {
return nil, fmt.Errorf("%q is not an Ethernet MAC address", mac)
}
m := &arpMessage{
arpHeader{
1, // Ethernet
... | go | func gratuitousARPReply(ip net.IP, mac net.HardwareAddr) (*arpMessage, error) {
if ip.To4() == nil {
return nil, fmt.Errorf("%q is not an IPv4 address", ip)
}
if len(mac) != hwLen {
return nil, fmt.Errorf("%q is not an Ethernet MAC address", mac)
}
m := &arpMessage{
arpHeader{
1, // Ethernet
... | [
"func",
"gratuitousARPReply",
"(",
"ip",
"net",
".",
"IP",
",",
"mac",
"net",
".",
"HardwareAddr",
")",
"(",
"*",
"arpMessage",
",",
"error",
")",
"{",
"if",
"ip",
".",
"To4",
"(",
")",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
... | // gratuitousARPReply returns an ARP message that contains a gratuitous ARP
// reply from the specified sender. | [
"gratuitousARPReply",
"returns",
"an",
"ARP",
"message",
"that",
"contains",
"a",
"gratuitous",
"ARP",
"reply",
"from",
"the",
"specified",
"sender",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/arp.go#L86-L109 |
26,597 | google/seesaw | ncc/arp.go | sendARP | func sendARP(iface *net.Interface, m *arpMessage) error {
fd, err := syscall.Socket(syscall.AF_PACKET, syscall.SOCK_DGRAM, int(htons(syscall.ETH_P_ARP)))
if err != nil {
return fmt.Errorf("failed to get raw socket: %v", err)
}
defer syscall.Close(fd)
if err := syscall.BindToDevice(fd, iface.Name); err != nil {
... | go | func sendARP(iface *net.Interface, m *arpMessage) error {
fd, err := syscall.Socket(syscall.AF_PACKET, syscall.SOCK_DGRAM, int(htons(syscall.ETH_P_ARP)))
if err != nil {
return fmt.Errorf("failed to get raw socket: %v", err)
}
defer syscall.Close(fd)
if err := syscall.BindToDevice(fd, iface.Name); err != nil {
... | [
"func",
"sendARP",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"m",
"*",
"arpMessage",
")",
"error",
"{",
"fd",
",",
"err",
":=",
"syscall",
".",
"Socket",
"(",
"syscall",
".",
"AF_PACKET",
",",
"syscall",
".",
"SOCK_DGRAM",
",",
"int",
"(",
"ht... | // sendARP sends the given ARP message via the specified interface. | [
"sendARP",
"sends",
"the",
"given",
"ARP",
"message",
"via",
"the",
"specified",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/arp.go#L112-L151 |
26,598 | google/seesaw | ncc/arp.go | ARPSendGratuitous | func (ncc *SeesawNCC) ARPSendGratuitous(arp *ncctypes.ARPGratuitous, out *int) error {
iface, err := net.InterfaceByName(arp.IfaceName)
if err != nil {
return fmt.Errorf("failed to get interface %q: %v", arp.IfaceName, err)
}
log.V(2).Infof("Sending gratuitous ARP for %s (%s) via %s", arp.IP, iface.HardwareAddr, ... | go | func (ncc *SeesawNCC) ARPSendGratuitous(arp *ncctypes.ARPGratuitous, out *int) error {
iface, err := net.InterfaceByName(arp.IfaceName)
if err != nil {
return fmt.Errorf("failed to get interface %q: %v", arp.IfaceName, err)
}
log.V(2).Infof("Sending gratuitous ARP for %s (%s) via %s", arp.IP, iface.HardwareAddr, ... | [
"func",
"(",
"ncc",
"*",
"SeesawNCC",
")",
"ARPSendGratuitous",
"(",
"arp",
"*",
"ncctypes",
".",
"ARPGratuitous",
",",
"out",
"*",
"int",
")",
"error",
"{",
"iface",
",",
"err",
":=",
"net",
".",
"InterfaceByName",
"(",
"arp",
".",
"IfaceName",
")",
"... | // ARPSendGratuitous sends a gratuitous ARP message via the specified interface. | [
"ARPSendGratuitous",
"sends",
"a",
"gratuitous",
"ARP",
"message",
"via",
"the",
"specified",
"interface",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/arp.go#L154-L165 |
26,599 | google/seesaw | healthcheck/radius.go | String | func (rc radiusCode) String() string {
if name, ok := rcNames[rc]; ok {
return name
}
return fmt.Sprintf("(unknown %d)", rc)
} | go | func (rc radiusCode) String() string {
if name, ok := rcNames[rc]; ok {
return name
}
return fmt.Sprintf("(unknown %d)", rc)
} | [
"func",
"(",
"rc",
"radiusCode",
")",
"String",
"(",
")",
"string",
"{",
"if",
"name",
",",
"ok",
":=",
"rcNames",
"[",
"rc",
"]",
";",
"ok",
"{",
"return",
"name",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rc",
"... | // String returns the string representation of a RADIUS code. | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"a",
"RADIUS",
"code",
"."
] | 34716af0775ecb1fad239a726390d63d6b0742dd | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/radius.go#L81-L86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.