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
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
google/seesaw
common/conn/conn.go
RegisterEngineConn
func RegisterEngineConn(connType string, connFunc func(ctx *ipc.Context) EngineConn) { engineConns[connType] = connFunc }
go
func RegisterEngineConn(connType string, connFunc func(ctx *ipc.Context) EngineConn) { engineConns[connType] = connFunc }
[ "func", "RegisterEngineConn", "(", "connType", "string", ",", "connFunc", "func", "(", "ctx", "*", "ipc", ".", "Context", ")", "EngineConn", ")", "{", "engineConns", "[", "connType", "]", "=", "connFunc", "\n", "}" ]
// RegisterEngineConn registers the given connection type.
[ "RegisterEngineConn", "registers", "the", "given", "connection", "type", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/conn.go#L59-L61
train
google/seesaw
common/conn/conn.go
NewSeesawIPC
func NewSeesawIPC(ctx *ipc.Context) (*Seesaw, error) { if newConn, ok := engineConns["ipc"]; ok { return &Seesaw{newConn(ctx)}, nil } return nil, errors.New("No Seesaw IPC connection type registered") }
go
func NewSeesawIPC(ctx *ipc.Context) (*Seesaw, error) { if newConn, ok := engineConns["ipc"]; ok { return &Seesaw{newConn(ctx)}, nil } return nil, errors.New("No Seesaw IPC connection type registered") }
[ "func", "NewSeesawIPC", "(", "ctx", "*", "ipc", ".", "Context", ")", "(", "*", "Seesaw", ",", "error", ")", "{", "if", "newConn", ",", "ok", ":=", "engineConns", "[", "\"", "\"", "]", ";", "ok", "{", "return", "&", "Seesaw", "{", "newConn", "(", ...
// NewSeesawIPC returns a new Seesaw IPC connection.
[ "NewSeesawIPC", "returns", "a", "new", "Seesaw", "IPC", "connection", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/conn.go#L69-L74
train
google/seesaw
binaries/seesaw_watchdog/main.go
svcOpt
func svcOpt(cfg *conf.ConfigFile, service, option string, required bool) string { // TODO(jsing): Add support for defaults. opt := cfgOpt(cfg, service, option) if opt == "" && required { log.Fatalf("Service %s has missing %s option", service, option) } return opt }
go
func svcOpt(cfg *conf.ConfigFile, service, option string, required bool) string { // TODO(jsing): Add support for defaults. opt := cfgOpt(cfg, service, option) if opt == "" && required { log.Fatalf("Service %s has missing %s option", service, option) } return opt }
[ "func", "svcOpt", "(", "cfg", "*", "conf", ".", "ConfigFile", ",", "service", ",", "option", "string", ",", "required", "bool", ")", "string", "{", "// TODO(jsing): Add support for defaults.", "opt", ":=", "cfgOpt", "(", "cfg", ",", "service", ",", "option", ...
// svcOpt returns the specified configuration option for a service.
[ "svcOpt", "returns", "the", "specified", "configuration", "option", "for", "a", "service", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/binaries/seesaw_watchdog/main.go#L53-L60
train
google/seesaw
engine/ipc.go
Failover
func (s *SeesawEngine) Failover(ctx *ipc.Context, reply *int) error { s.trace("Failover", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } return s.engine.haManager.requestFailover(false) }
go
func (s *SeesawEngine) Failover(ctx *ipc.Context, reply *int) error { s.trace("Failover", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } return s.engine.haManager.requestFailover(false) }
[ "func", "(", "s", "*", "SeesawEngine", ")", "Failover", "(", "ctx", "*", "ipc", ".", "Context", ",", "reply", "*", "int", ")", "error", "{", "s", ".", "trace", "(", "\"", "\"", ",", "ctx", ")", "\n", "if", "ctx", "==", "nil", "{", "return", "er...
// Failover requests the Seesaw Engine to relinquish master state.
[ "Failover", "requests", "the", "Seesaw", "Engine", "to", "relinquish", "master", "state", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L51-L62
train
google/seesaw
engine/ipc.go
HAConfig
func (s *SeesawEngine) HAConfig(ctx *ipc.Context, reply *seesaw.HAConfig) error { s.trace("HAConfig", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } c, err := s.engine.haConfig() if err != nil { return err } if reply != nil { ...
go
func (s *SeesawEngine) HAConfig(ctx *ipc.Context, reply *seesaw.HAConfig) error { s.trace("HAConfig", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } c, err := s.engine.haConfig() if err != nil { return err } if reply != nil { ...
[ "func", "(", "s", "*", "SeesawEngine", ")", "HAConfig", "(", "ctx", "*", "ipc", ".", "Context", ",", "reply", "*", "seesaw", ".", "HAConfig", ")", "error", "{", "s", ".", "trace", "(", "\"", "\"", ",", "ctx", ")", "\n", "if", "ctx", "==", "nil", ...
// HAConfig returns the high-availability configuration for this node as // determined by the engine.
[ "HAConfig", "returns", "the", "high", "-", "availability", "configuration", "for", "this", "node", "as", "determined", "by", "the", "engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L66-L84
train
google/seesaw
engine/ipc.go
HAUpdate
func (s *SeesawEngine) HAUpdate(args *ipc.HAStatus, failover *bool) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("HAUpdate", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } s.engine.setHAS...
go
func (s *SeesawEngine) HAUpdate(args *ipc.HAStatus, failover *bool) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("HAUpdate", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } s.engine.setHAS...
[ "func", "(", "s", "*", "SeesawEngine", ")", "HAUpdate", "(", "args", "*", "ipc", ".", "HAStatus", ",", "failover", "*", "bool", ")", "error", "{", "if", "args", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\...
// HAUpdate advises the Engine of the current high-availability status for // the Seesaw HA component. The Seesaw Engine may also request a failover // in response.
[ "HAUpdate", "advises", "the", "Engine", "of", "the", "current", "high", "-", "availability", "status", "for", "the", "Seesaw", "HA", "component", ".", "The", "Seesaw", "Engine", "may", "also", "request", "a", "failover", "in", "response", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L89-L108
train
google/seesaw
engine/ipc.go
HAState
func (s *SeesawEngine) HAState(args *ipc.HAState, reply *int) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("HAState", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } s.engine.setHAState(ar...
go
func (s *SeesawEngine) HAState(args *ipc.HAState, reply *int) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("HAState", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } s.engine.setHAState(ar...
[ "func", "(", "s", "*", "SeesawEngine", ")", "HAState", "(", "args", "*", "ipc", ".", "HAState", ",", "reply", "*", "int", ")", "error", "{", "if", "args", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", ...
// HAState advises the Engine of the current high-availability state as // determined by the Seesaw HA component.
[ "HAState", "advises", "the", "Engine", "of", "the", "current", "high", "-", "availability", "state", "as", "determined", "by", "the", "Seesaw", "HA", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L112-L128
train
google/seesaw
engine/ipc.go
Healthchecks
func (s *SeesawEngine) Healthchecks(ctx *ipc.Context, reply *healthcheck.Checks) error { s.trace("Healthchecks", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } configs := s.engine.hcManager.configs() if reply != nil { reply.Conf...
go
func (s *SeesawEngine) Healthchecks(ctx *ipc.Context, reply *healthcheck.Checks) error { s.trace("Healthchecks", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } configs := s.engine.hcManager.configs() if reply != nil { reply.Conf...
[ "func", "(", "s", "*", "SeesawEngine", ")", "Healthchecks", "(", "ctx", "*", "ipc", ".", "Context", ",", "reply", "*", "healthcheck", ".", "Checks", ")", "error", "{", "s", ".", "trace", "(", "\"", "\"", ",", "ctx", ")", "\n", "if", "ctx", "==", ...
// Healthchecks returns a list of currently configured healthchecks that // should be performed by the Seesaw Healthcheck component.
[ "Healthchecks", "returns", "a", "list", "of", "currently", "configured", "healthchecks", "that", "should", "be", "performed", "by", "the", "Seesaw", "Healthcheck", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L149-L164
train
google/seesaw
engine/ipc.go
HealthState
func (s *SeesawEngine) HealthState(args *healthcheck.HealthState, reply *int) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("HealthState", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } fo...
go
func (s *SeesawEngine) HealthState(args *healthcheck.HealthState, reply *int) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("HealthState", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } fo...
[ "func", "(", "s", "*", "SeesawEngine", ")", "HealthState", "(", "args", "*", "healthcheck", ".", "HealthState", ",", "reply", "*", "int", ")", "error", "{", "if", "args", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", ...
// HealthState advises the Seesaw Engine of state transitions for a set of // healthchecks that are being performed by the Seesaw Healthcheck component.
[ "HealthState", "advises", "the", "Seesaw", "Engine", "of", "state", "transitions", "for", "a", "set", "of", "healthchecks", "that", "are", "being", "performed", "by", "the", "Seesaw", "Healthcheck", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L168-L189
train
google/seesaw
engine/ipc.go
ClusterStatus
func (s *SeesawEngine) ClusterStatus(ctx *ipc.Context, reply *seesaw.ClusterStatus) error { s.trace("ClusterStatus", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } s.engine.clusterLock.RLock() cluster := s.engine.cluster s.engine...
go
func (s *SeesawEngine) ClusterStatus(ctx *ipc.Context, reply *seesaw.ClusterStatus) error { s.trace("ClusterStatus", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } s.engine.clusterLock.RLock() cluster := s.engine.cluster s.engine...
[ "func", "(", "s", "*", "SeesawEngine", ")", "ClusterStatus", "(", "ctx", "*", "ipc", ".", "Context", ",", "reply", "*", "seesaw", ".", "ClusterStatus", ")", "error", "{", "s", ".", "trace", "(", "\"", "\"", ",", "ctx", ")", "\n", "if", "ctx", "==",...
// ClusterStatus returns status information about this Seesaw Cluster.
[ "ClusterStatus", "returns", "status", "information", "about", "this", "Seesaw", "Cluster", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L192-L217
train
google/seesaw
engine/ipc.go
VLANs
func (s *SeesawEngine) VLANs(ctx *ipc.Context, reply *seesaw.VLANs) error { s.trace("VLANs", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } if reply == nil { return errors.New("VLANs is nil") } reply.VLANs = make([]*seesaw.VLAN...
go
func (s *SeesawEngine) VLANs(ctx *ipc.Context, reply *seesaw.VLANs) error { s.trace("VLANs", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } if reply == nil { return errors.New("VLANs is nil") } reply.VLANs = make([]*seesaw.VLAN...
[ "func", "(", "s", "*", "SeesawEngine", ")", "VLANs", "(", "ctx", "*", "ipc", ".", "Context", ",", "reply", "*", "seesaw", ".", "VLANs", ")", "error", "{", "s", ".", "trace", "(", "\"", "\"", ",", "ctx", ")", "\n", "if", "ctx", "==", "nil", "{",...
// VLANs returns a list of VLANs configured for this cluster.
[ "VLANs", "returns", "a", "list", "of", "VLANs", "configured", "for", "this", "cluster", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L318-L338
train
google/seesaw
engine/ipc.go
OverrideBackend
func (s *SeesawEngine) OverrideBackend(args *ipc.Override, reply *int) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("OverrideBackend", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } if ar...
go
func (s *SeesawEngine) OverrideBackend(args *ipc.Override, reply *int) error { if args == nil { return errors.New("args is nil") } ctx := args.Ctx s.trace("OverrideBackend", ctx) if ctx == nil { return errors.New("context is nil") } if !ctx.IsTrusted() { return errors.New("insufficient access") } if ar...
[ "func", "(", "s", "*", "SeesawEngine", ")", "OverrideBackend", "(", "args", "*", "ipc", ".", "Override", ",", "reply", "*", "int", ")", "error", "{", "if", "args", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", ...
// OverrideBackend passes a BackendOverride to the engine.
[ "OverrideBackend", "passes", "a", "BackendOverride", "to", "the", "engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/ipc.go#L364-L383
train
google/seesaw
common/conn/rpc.go
ClusterStatus
func (c *engineRPC) ClusterStatus() (*seesaw.ClusterStatus, error) { var cs seesaw.ClusterStatus if err := c.client.Call("SeesawECU.ClusterStatus", c.ctx, &cs); err != nil { return nil, err } return &cs, nil }
go
func (c *engineRPC) ClusterStatus() (*seesaw.ClusterStatus, error) { var cs seesaw.ClusterStatus if err := c.client.Call("SeesawECU.ClusterStatus", c.ctx, &cs); err != nil { return nil, err } return &cs, nil }
[ "func", "(", "c", "*", "engineRPC", ")", "ClusterStatus", "(", ")", "(", "*", "seesaw", ".", "ClusterStatus", ",", "error", ")", "{", "var", "cs", "seesaw", ".", "ClusterStatus", "\n", "if", "err", ":=", "c", ".", "client", ".", "Call", "(", "\"", ...
// ClusterStatus requests the status of the Seesaw Cluster.
[ "ClusterStatus", "requests", "the", "status", "of", "the", "Seesaw", "Cluster", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/rpc.go#L77-L83
train
google/seesaw
common/conn/rpc.go
Backends
func (c *engineRPC) Backends() (map[string]*seesaw.Backend, error) { var bm seesaw.BackendMap if err := c.client.Call("SeesawECU.Backends", c.ctx, &bm); err != nil { return nil, err } return bm.Backends, nil }
go
func (c *engineRPC) Backends() (map[string]*seesaw.Backend, error) { var bm seesaw.BackendMap if err := c.client.Call("SeesawECU.Backends", c.ctx, &bm); err != nil { return nil, err } return bm.Backends, nil }
[ "func", "(", "c", "*", "engineRPC", ")", "Backends", "(", ")", "(", "map", "[", "string", "]", "*", "seesaw", ".", "Backend", ",", "error", ")", "{", "var", "bm", "seesaw", ".", "BackendMap", "\n", "if", "err", ":=", "c", ".", "client", ".", "Cal...
// Backends requests a list of all backends that are configured on the cluster.
[ "Backends", "requests", "a", "list", "of", "all", "backends", "that", "are", "configured", "on", "the", "cluster", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/rpc.go#L148-L154
train
google/seesaw
common/conn/rpc.go
OverrideBackend
func (c *engineRPC) OverrideBackend(backend *seesaw.BackendOverride) error { override := &ipc.Override{Ctx: c.ctx, Backend: backend} return c.client.Call("SeesawECU.OverrideBackend", override, nil) }
go
func (c *engineRPC) OverrideBackend(backend *seesaw.BackendOverride) error { override := &ipc.Override{Ctx: c.ctx, Backend: backend} return c.client.Call("SeesawECU.OverrideBackend", override, nil) }
[ "func", "(", "c", "*", "engineRPC", ")", "OverrideBackend", "(", "backend", "*", "seesaw", ".", "BackendOverride", ")", "error", "{", "override", ":=", "&", "ipc", ".", "Override", "{", "Ctx", ":", "c", ".", "ctx", ",", "Backend", ":", "backend", "}", ...
// OverrideBackend requests that the specified VserverOverride be applied.
[ "OverrideBackend", "requests", "that", "the", "specified", "VserverOverride", "be", "applied", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/rpc.go#L157-L160
train
google/seesaw
healthcheck/ping.go
NewPingChecker
func NewPingChecker(ip net.IP) *PingChecker { proto := seesaw.IPProtoICMP if ip.To4() == nil { proto = seesaw.IPProtoICMPv6 } id := nextPingCheckerID nextPingCheckerID++ return &PingChecker{ Target: Target{ IP: ip, Proto: proto, }, ID: id, } }
go
func NewPingChecker(ip net.IP) *PingChecker { proto := seesaw.IPProtoICMP if ip.To4() == nil { proto = seesaw.IPProtoICMPv6 } id := nextPingCheckerID nextPingCheckerID++ return &PingChecker{ Target: Target{ IP: ip, Proto: proto, }, ID: id, } }
[ "func", "NewPingChecker", "(", "ip", "net", ".", "IP", ")", "*", "PingChecker", "{", "proto", ":=", "seesaw", ".", "IPProtoICMP", "\n", "if", "ip", ".", "To4", "(", ")", "==", "nil", "{", "proto", "=", "seesaw", ".", "IPProtoICMPv6", "\n", "}", "\n",...
// NewPingChecker returns an initialised PingChecker.
[ "NewPingChecker", "returns", "an", "initialised", "PingChecker", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/ping.go#L51-L65
train
google/seesaw
healthcheck/ping.go
Check
func (hc *PingChecker) Check(timeout time.Duration) *Result { msg := fmt.Sprintf("ICMP ping to host %v", hc.IP) seq := hc.Seqnum hc.Seqnum++ echo := newICMPEchoRequest(hc.Proto, hc.ID, seq, 64, []byte("Healthcheck")) start := time.Now() if timeout == time.Duration(0) { timeout = defaultPingTimeout } err := ex...
go
func (hc *PingChecker) Check(timeout time.Duration) *Result { msg := fmt.Sprintf("ICMP ping to host %v", hc.IP) seq := hc.Seqnum hc.Seqnum++ echo := newICMPEchoRequest(hc.Proto, hc.ID, seq, 64, []byte("Healthcheck")) start := time.Now() if timeout == time.Duration(0) { timeout = defaultPingTimeout } err := ex...
[ "func", "(", "hc", "*", "PingChecker", ")", "Check", "(", "timeout", "time", ".", "Duration", ")", "*", "Result", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "hc", ".", "IP", ")", "\n", "seq", ":=", "hc", ".", "Seqnum", "\n", ...
// Check executes a ping healthcheck.
[ "Check", "executes", "a", "ping", "healthcheck", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/ping.go#L73-L85
train
google/seesaw
ha/net.go
NewIPHAConn
func NewIPHAConn(laddr, raddr net.IP) (HAConn, error) { sendConn, err := IPConn(laddr, raddr) if err != nil { return nil, err } // For IPv6 unicast and multicast, and for IPv4 unicast, we can use the same IPConn for both // sending and receiving. For IPv4 multicast, we need a separate listener for receiving. r...
go
func NewIPHAConn(laddr, raddr net.IP) (HAConn, error) { sendConn, err := IPConn(laddr, raddr) if err != nil { return nil, err } // For IPv6 unicast and multicast, and for IPv4 unicast, we can use the same IPConn for both // sending and receiving. For IPv4 multicast, we need a separate listener for receiving. r...
[ "func", "NewIPHAConn", "(", "laddr", ",", "raddr", "net", ".", "IP", ")", "(", "HAConn", ",", "error", ")", "{", "sendConn", ",", "err", ":=", "IPConn", "(", "laddr", ",", "raddr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "...
// NewIPHAConn creates a new IPHAConn.
[ "NewIPHAConn", "creates", "a", "new", "IPHAConn", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L143-L172
train
google/seesaw
ha/net.go
ListenMulticastIPv4
func ListenMulticastIPv4(gaddr, laddr net.IP) (*net.IPConn, error) { gaddr = gaddr.To4() laddr = laddr.To4() c, err := net.ListenIP("ip4:112", &net.IPAddr{IP: gaddr}) if err != nil { return nil, err } f, err := c.File() if err != nil { return nil, err } defer f.Close() mreq := &syscall.IPMreq{ Multiad...
go
func ListenMulticastIPv4(gaddr, laddr net.IP) (*net.IPConn, error) { gaddr = gaddr.To4() laddr = laddr.To4() c, err := net.ListenIP("ip4:112", &net.IPAddr{IP: gaddr}) if err != nil { return nil, err } f, err := c.File() if err != nil { return nil, err } defer f.Close() mreq := &syscall.IPMreq{ Multiad...
[ "func", "ListenMulticastIPv4", "(", "gaddr", ",", "laddr", "net", ".", "IP", ")", "(", "*", "net", ".", "IPConn", ",", "error", ")", "{", "gaddr", "=", "gaddr", ".", "To4", "(", ")", "\n", "laddr", "=", "laddr", ".", "To4", "(", ")", "\n", "c", ...
// ListenMulticastIPv4 creates a net.IPConn to receive multicast messages for the given group // address. laddr specifies which network interface to use when joining the group.
[ "ListenMulticastIPv4", "creates", "a", "net", ".", "IPConn", "to", "receive", "multicast", "messages", "for", "the", "given", "group", "address", ".", "laddr", "specifies", "which", "network", "interface", "to", "use", "when", "joining", "the", "group", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L176-L201
train
google/seesaw
ha/net.go
JoinMulticastIPv6
func JoinMulticastIPv6(c *net.IPConn, gaddr, laddr net.IP) error { f, err := c.File() if err != nil { return err } defer f.Close() mreq := &syscall.IPv6Mreq{} copy(mreq.Multiaddr[:], gaddr.To16()) iface, err := findInterface(laddr) if err != nil { return err } mreq.Interface = uint32(iface.Index) err =...
go
func JoinMulticastIPv6(c *net.IPConn, gaddr, laddr net.IP) error { f, err := c.File() if err != nil { return err } defer f.Close() mreq := &syscall.IPv6Mreq{} copy(mreq.Multiaddr[:], gaddr.To16()) iface, err := findInterface(laddr) if err != nil { return err } mreq.Interface = uint32(iface.Index) err =...
[ "func", "JoinMulticastIPv6", "(", "c", "*", "net", ".", "IPConn", ",", "gaddr", ",", "laddr", "net", ".", "IP", ")", "error", "{", "f", ",", "err", ":=", "c", ".", "File", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}...
// JoinMulticastIPv6 joins the multicast group address given by gaddr. laddr specifies which // network interface to use when joining the group.
[ "JoinMulticastIPv6", "joins", "the", "multicast", "group", "address", "given", "by", "gaddr", ".", "laddr", "specifies", "which", "network", "interface", "to", "use", "when", "joining", "the", "group", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L205-L225
train
google/seesaw
ha/net.go
af
func (c *IPHAConn) af() int { if c.laddr.To4() != nil { return syscall.AF_INET } return syscall.AF_INET6 }
go
func (c *IPHAConn) af() int { if c.laddr.To4() != nil { return syscall.AF_INET } return syscall.AF_INET6 }
[ "func", "(", "c", "*", "IPHAConn", ")", "af", "(", ")", "int", "{", "if", "c", ".", "laddr", ".", "To4", "(", ")", "!=", "nil", "{", "return", "syscall", ".", "AF_INET", "\n", "}", "\n", "return", "syscall", ".", "AF_INET6", "\n", "}" ]
// af returns the address family for an IPHAConn.
[ "af", "returns", "the", "address", "family", "for", "an", "IPHAConn", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L248-L253
train
google/seesaw
ha/net.go
readPacket
func (c *IPHAConn) readPacket() (*packet, error) { switch c.af() { case syscall.AF_INET: return c.readIPv4Packet() case syscall.AF_INET6: return c.readIPv6Packet() } panic("unreachable") }
go
func (c *IPHAConn) readPacket() (*packet, error) { switch c.af() { case syscall.AF_INET: return c.readIPv4Packet() case syscall.AF_INET6: return c.readIPv6Packet() } panic("unreachable") }
[ "func", "(", "c", "*", "IPHAConn", ")", "readPacket", "(", ")", "(", "*", "packet", ",", "error", ")", "{", "switch", "c", ".", "af", "(", ")", "{", "case", "syscall", ".", "AF_INET", ":", "return", "c", ".", "readIPv4Packet", "(", ")", "\n", "ca...
// readPacket reads a packet from this IPHAConn's recvConn.
[ "readPacket", "reads", "a", "packet", "from", "this", "IPHAConn", "s", "recvConn", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ha/net.go#L329-L337
train
google/seesaw
watchdog/core.go
NewWatchdog
func NewWatchdog() *Watchdog { return &Watchdog{ services: make(map[string]*Service), shutdown: make(chan bool), } }
go
func NewWatchdog() *Watchdog { return &Watchdog{ services: make(map[string]*Service), shutdown: make(chan bool), } }
[ "func", "NewWatchdog", "(", ")", "*", "Watchdog", "{", "return", "&", "Watchdog", "{", "services", ":", "make", "(", "map", "[", "string", "]", "*", "Service", ")", ",", "shutdown", ":", "make", "(", "chan", "bool", ")", ",", "}", "\n", "}" ]
// NewWatchdog returns an initialised watchdog.
[ "NewWatchdog", "returns", "an", "initialised", "watchdog", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/core.go#L37-L42
train
google/seesaw
watchdog/core.go
AddService
func (w *Watchdog) AddService(name, binary string) (*Service, error) { if _, ok := w.services[name]; ok { return nil, fmt.Errorf("Service %q already exists", name) } svc := newService(name, binary) w.services[name] = svc return svc, nil }
go
func (w *Watchdog) AddService(name, binary string) (*Service, error) { if _, ok := w.services[name]; ok { return nil, fmt.Errorf("Service %q already exists", name) } svc := newService(name, binary) w.services[name] = svc return svc, nil }
[ "func", "(", "w", "*", "Watchdog", ")", "AddService", "(", "name", ",", "binary", "string", ")", "(", "*", "Service", ",", "error", ")", "{", "if", "_", ",", "ok", ":=", "w", ".", "services", "[", "name", "]", ";", "ok", "{", "return", "nil", "...
// AddService adds a service that is to be run by the watchdog.
[ "AddService", "adds", "a", "service", "that", "is", "to", "be", "run", "by", "the", "watchdog", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/core.go#L53-L62
train
google/seesaw
watchdog/core.go
Walk
func (w *Watchdog) Walk() { log.Info("Seesaw watchdog starting...") w.mapDependencies() for _, svc := range w.services { go svc.run() } <-w.shutdown for _, svc := range w.services { go svc.stop() } for _, svc := range w.services { stopped := <-svc.stopped svc.stopped <- stopped } }
go
func (w *Watchdog) Walk() { log.Info("Seesaw watchdog starting...") w.mapDependencies() for _, svc := range w.services { go svc.run() } <-w.shutdown for _, svc := range w.services { go svc.stop() } for _, svc := range w.services { stopped := <-svc.stopped svc.stopped <- stopped } }
[ "func", "(", "w", "*", "Watchdog", ")", "Walk", "(", ")", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n\n", "w", ".", "mapDependencies", "(", ")", "\n\n", "for", "_", ",", "svc", ":=", "range", "w", ".", "services", "{", "go", "svc", ".", ...
// Walk takes the watchdog component for a walk so that it can run the // configured services.
[ "Walk", "takes", "the", "watchdog", "component", "for", "a", "walk", "so", "that", "it", "can", "run", "the", "configured", "services", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/core.go#L66-L82
train
google/seesaw
watchdog/core.go
mapDependencies
func (w *Watchdog) mapDependencies() { for name := range w.services { svc := w.services[name] for depName := range svc.dependencies { dep, ok := w.services[depName] if !ok { log.Fatalf("Failed to find dependency %q for service %q", depName, name) } svc.dependencies[depName] = dep dep.dependents[...
go
func (w *Watchdog) mapDependencies() { for name := range w.services { svc := w.services[name] for depName := range svc.dependencies { dep, ok := w.services[depName] if !ok { log.Fatalf("Failed to find dependency %q for service %q", depName, name) } svc.dependencies[depName] = dep dep.dependents[...
[ "func", "(", "w", "*", "Watchdog", ")", "mapDependencies", "(", ")", "{", "for", "name", ":=", "range", "w", ".", "services", "{", "svc", ":=", "w", ".", "services", "[", "name", "]", "\n", "for", "depName", ":=", "range", "svc", ".", "dependencies",...
// mapDependencies maps service dependency names to configured services.
[ "mapDependencies", "maps", "service", "dependency", "names", "to", "configured", "services", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/watchdog/core.go#L85-L97
train
google/seesaw
ecu/control.go
VLANs
func (s *SeesawECU) VLANs(ctx *ipc.Context, reply *seesaw.VLANs) error { s.trace("VLANs", ctx) authConn, err := s.ecu.authConnect(ctx) if err != nil { return err } defer authConn.Close() vlans, err := authConn.VLANs() if err != nil { return err } if reply != nil { *reply = *vlans } return nil }
go
func (s *SeesawECU) VLANs(ctx *ipc.Context, reply *seesaw.VLANs) error { s.trace("VLANs", ctx) authConn, err := s.ecu.authConnect(ctx) if err != nil { return err } defer authConn.Close() vlans, err := authConn.VLANs() if err != nil { return err } if reply != nil { *reply = *vlans } return nil }
[ "func", "(", "s", "*", "SeesawECU", ")", "VLANs", "(", "ctx", "*", "ipc", ".", "Context", ",", "reply", "*", "seesaw", ".", "VLANs", ")", "error", "{", "s", ".", "trace", "(", "\"", "\"", ",", "ctx", ")", "\n\n", "authConn", ",", "err", ":=", "...
// VLANs returns a list of currently configured VLANs.
[ "VLANs", "returns", "a", "list", "of", "currently", "configured", "VLANs", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/control.go#L184-L202
train
google/seesaw
healthcheck/dns.go
DNSType
func DNSType(name string) (uint16, error) { dt, ok := dns.StringToType[strings.ToUpper(name)] if !ok { return 0, fmt.Errorf("unknown DNS type %q", name) } return dt, nil }
go
func DNSType(name string) (uint16, error) { dt, ok := dns.StringToType[strings.ToUpper(name)] if !ok { return 0, fmt.Errorf("unknown DNS type %q", name) } return dt, nil }
[ "func", "DNSType", "(", "name", "string", ")", "(", "uint16", ",", "error", ")", "{", "dt", ",", "ok", ":=", "dns", ".", "StringToType", "[", "strings", ".", "ToUpper", "(", "name", ")", "]", "\n", "if", "!", "ok", "{", "return", "0", ",", "fmt",...
// DNSType returns the dnsType that corresponds with the given name.
[ "DNSType", "returns", "the", "dnsType", "that", "corresponds", "with", "the", "given", "name", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/dns.go#L37-L43
train
google/seesaw
healthcheck/dns.go
NewDNSChecker
func NewDNSChecker(ip net.IP, port int) *DNSChecker { return &DNSChecker{ Target: Target{ IP: ip, Port: port, Proto: seesaw.IPProtoUDP, }, Question: dns.Question{ Qclass: dns.ClassINET, Qtype: dns.TypeA, }, } }
go
func NewDNSChecker(ip net.IP, port int) *DNSChecker { return &DNSChecker{ Target: Target{ IP: ip, Port: port, Proto: seesaw.IPProtoUDP, }, Question: dns.Question{ Qclass: dns.ClassINET, Qtype: dns.TypeA, }, } }
[ "func", "NewDNSChecker", "(", "ip", "net", ".", "IP", ",", "port", "int", ")", "*", "DNSChecker", "{", "return", "&", "DNSChecker", "{", "Target", ":", "Target", "{", "IP", ":", "ip", ",", "Port", ":", "port", ",", "Proto", ":", "seesaw", ".", "IPP...
// NewDNSChecker returns an initialised DNSChecker.
[ "NewDNSChecker", "returns", "an", "initialised", "DNSChecker", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/dns.go#L53-L65
train
google/seesaw
healthcheck/dns.go
String
func (hc *DNSChecker) String() string { return fmt.Sprintf("DNS %s %s", questionToString(hc.Question), hc.Target) }
go
func (hc *DNSChecker) String() string { return fmt.Sprintf("DNS %s %s", questionToString(hc.Question), hc.Target) }
[ "func", "(", "hc", "*", "DNSChecker", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "questionToString", "(", "hc", ".", "Question", ")", ",", "hc", ".", "Target", ")", "\n", "}" ]
// String returns the string representation of a DNS healthcheck.
[ "String", "returns", "the", "string", "representation", "of", "a", "DNS", "healthcheck", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/healthcheck/dns.go#L72-L74
train
google/seesaw
quagga/vty.go
NewVTY
func NewVTY(socket string) *VTY { return &VTY{ socket: socket, readTimeout: 1 * time.Second, writeTimeout: 1 * time.Second, } }
go
func NewVTY(socket string) *VTY { return &VTY{ socket: socket, readTimeout: 1 * time.Second, writeTimeout: 1 * time.Second, } }
[ "func", "NewVTY", "(", "socket", "string", ")", "*", "VTY", "{", "return", "&", "VTY", "{", "socket", ":", "socket", ",", "readTimeout", ":", "1", "*", "time", ".", "Second", ",", "writeTimeout", ":", "1", "*", "time", ".", "Second", ",", "}", "\n"...
// NewVTY returns an initialised VTY struct.
[ "NewVTY", "returns", "an", "initialised", "VTY", "struct", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/quagga/vty.go#L49-L55
train
google/seesaw
quagga/vty.go
Dial
func (v *VTY) Dial() error { if v.conn != nil { return fmt.Errorf("connection already established") } conn, err := net.Dial("unix", v.socket) if err != nil { return err } v.conn = conn return nil }
go
func (v *VTY) Dial() error { if v.conn != nil { return fmt.Errorf("connection already established") } conn, err := net.Dial("unix", v.socket) if err != nil { return err } v.conn = conn return nil }
[ "func", "(", "v", "*", "VTY", ")", "Dial", "(", ")", "error", "{", "if", "v", ".", "conn", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "conn", ",", "err", ":=", "net", ".", "Dial", "(", "\"", "\"...
// Dial establishes a connection to a Quagga VTY socket.
[ "Dial", "establishes", "a", "connection", "to", "a", "Quagga", "VTY", "socket", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/quagga/vty.go#L58-L68
train
google/seesaw
quagga/vty.go
Close
func (v *VTY) Close() error { if v.conn == nil { return fmt.Errorf("No connection established") } err := v.conn.Close() v.conn = nil return err }
go
func (v *VTY) Close() error { if v.conn == nil { return fmt.Errorf("No connection established") } err := v.conn.Close() v.conn = nil return err }
[ "func", "(", "v", "*", "VTY", ")", "Close", "(", ")", "error", "{", "if", "v", ".", "conn", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "err", ":=", "v", ".", "conn", ".", "Close", "(", ")", "\n"...
// Close closes a connection to a Quagga VTY socket.
[ "Close", "closes", "a", "connection", "to", "a", "Quagga", "VTY", "socket", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/quagga/vty.go#L71-L78
train
google/seesaw
quagga/vty.go
Commands
func (v *VTY) Commands(cmds []string) error { for _, cmd := range cmds { if _, err := v.Command(cmd); err != nil { return err } } return nil }
go
func (v *VTY) Commands(cmds []string) error { for _, cmd := range cmds { if _, err := v.Command(cmd); err != nil { return err } } return nil }
[ "func", "(", "v", "*", "VTY", ")", "Commands", "(", "cmds", "[", "]", "string", ")", "error", "{", "for", "_", ",", "cmd", ":=", "range", "cmds", "{", "if", "_", ",", "err", ":=", "v", ".", "Command", "(", "cmd", ")", ";", "err", "!=", "nil",...
// Commands issues a sequence of commands over the Quagga VTY, discarding // responses.
[ "Commands", "issues", "a", "sequence", "of", "commands", "over", "the", "Quagga", "VTY", "discarding", "responses", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/quagga/vty.go#L82-L89
train
google/seesaw
quagga/vty.go
Command
func (v *VTY) Command(cmd string) (string, error) { if err := v.write(cmd); err != nil { return "", err } r, s, err := v.read() if err != nil { return "", err } if s != 0 { return "", VTYError{r, s} } return r, nil }
go
func (v *VTY) Command(cmd string) (string, error) { if err := v.write(cmd); err != nil { return "", err } r, s, err := v.read() if err != nil { return "", err } if s != 0 { return "", VTYError{r, s} } return r, nil }
[ "func", "(", "v", "*", "VTY", ")", "Command", "(", "cmd", "string", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "v", ".", "write", "(", "cmd", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", ...
// Command issues the given command over the Quagga VTY and reads the response.
[ "Command", "issues", "the", "given", "command", "over", "the", "Quagga", "VTY", "and", "reads", "the", "response", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/quagga/vty.go#L92-L104
train
google/seesaw
common/ipc/ipc.go
String
func (at AuthType) String() string { if name, ok := authTypeNames[at]; ok { return name } return "(unknown)" }
go
func (at AuthType) String() string { if name, ok := authTypeNames[at]; ok { return name } return "(unknown)" }
[ "func", "(", "at", "AuthType", ")", "String", "(", ")", "string", "{", "if", "name", ",", "ok", ":=", "authTypeNames", "[", "at", "]", ";", "ok", "{", "return", "name", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
// String returns the string representation of an AuthType.
[ "String", "returns", "the", "string", "representation", "of", "an", "AuthType", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/ipc/ipc.go#L48-L53
train
google/seesaw
common/ipc/ipc.go
NewContext
func NewContext(component seesaw.Component) *Context { return &Context{ AuthType: ATNone, Peer: Peer{ Component: component, Identity: fmt.Sprintf("%s [pid %d]", component, os.Getpid()), }, } }
go
func NewContext(component seesaw.Component) *Context { return &Context{ AuthType: ATNone, Peer: Peer{ Component: component, Identity: fmt.Sprintf("%s [pid %d]", component, os.Getpid()), }, } }
[ "func", "NewContext", "(", "component", "seesaw", ".", "Component", ")", "*", "Context", "{", "return", "&", "Context", "{", "AuthType", ":", "ATNone", ",", "Peer", ":", "Peer", "{", "Component", ":", "component", ",", "Identity", ":", "fmt", ".", "Sprin...
// NewContext returns a new context for the given component.
[ "NewContext", "returns", "a", "new", "context", "for", "the", "given", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/ipc/ipc.go#L72-L80
train
google/seesaw
common/ipc/ipc.go
NewAuthContext
func NewAuthContext(component seesaw.Component, token string) *Context { ctx := NewContext(component) ctx.AuthToken = token ctx.AuthType = ATUntrusted return ctx }
go
func NewAuthContext(component seesaw.Component, token string) *Context { ctx := NewContext(component) ctx.AuthToken = token ctx.AuthType = ATUntrusted return ctx }
[ "func", "NewAuthContext", "(", "component", "seesaw", ".", "Component", ",", "token", "string", ")", "*", "Context", "{", "ctx", ":=", "NewContext", "(", "component", ")", "\n", "ctx", ".", "AuthToken", "=", "token", "\n", "ctx", ".", "AuthType", "=", "A...
// NewAuthContext returns a new authenticated context for the given component.
[ "NewAuthContext", "returns", "a", "new", "authenticated", "context", "for", "the", "given", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/ipc/ipc.go#L83-L88
train
google/seesaw
common/ipc/ipc.go
NewTrustedContext
func NewTrustedContext(component seesaw.Component) *Context { ctx := NewContext(component) ctx.AuthType = ATTrusted if u, err := user.Current(); err == nil { ctx.User = fmt.Sprintf("%s [uid %s]", u.Username, u.Uid) } else { ctx.User = fmt.Sprintf("(unknown) [uid %d]", os.Getuid()) } return ctx }
go
func NewTrustedContext(component seesaw.Component) *Context { ctx := NewContext(component) ctx.AuthType = ATTrusted if u, err := user.Current(); err == nil { ctx.User = fmt.Sprintf("%s [uid %s]", u.Username, u.Uid) } else { ctx.User = fmt.Sprintf("(unknown) [uid %d]", os.Getuid()) } return ctx }
[ "func", "NewTrustedContext", "(", "component", "seesaw", ".", "Component", ")", "*", "Context", "{", "ctx", ":=", "NewContext", "(", "component", ")", "\n", "ctx", ".", "AuthType", "=", "ATTrusted", "\n", "if", "u", ",", "err", ":=", "user", ".", "Curren...
// NewTrustedContext returns a new trusted context for the given component.
[ "NewTrustedContext", "returns", "a", "new", "trusted", "context", "for", "the", "given", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/ipc/ipc.go#L91-L100
train
google/seesaw
common/ipc/ipc.go
String
func (ctx *Context) String() string { if ctx == nil { return "(nil context)" } var s []string if ctx.Peer.Component != seesaw.SCNone { s = append(s, fmt.Sprintf("peer %s", ctx.Peer.Identity)) } if ctx.Proxy.Component != seesaw.SCNone { s = append(s, fmt.Sprintf("via %s", ctx.Proxy.Identity)) } s = append...
go
func (ctx *Context) String() string { if ctx == nil { return "(nil context)" } var s []string if ctx.Peer.Component != seesaw.SCNone { s = append(s, fmt.Sprintf("peer %s", ctx.Peer.Identity)) } if ctx.Proxy.Component != seesaw.SCNone { s = append(s, fmt.Sprintf("via %s", ctx.Proxy.Identity)) } s = append...
[ "func", "(", "ctx", "*", "Context", ")", "String", "(", ")", "string", "{", "if", "ctx", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "var", "s", "[", "]", "string", "\n", "if", "ctx", ".", "Peer", ".", "Component", "!=", "seesaw", ...
// String returns the string representation of a context.
[ "String", "returns", "the", "string", "representation", "of", "a", "context", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/ipc/ipc.go#L103-L117
train
google/seesaw
ecu/core.go
NewECU
func NewECU(cfg *ECUConfig) *ECU { if cfg == nil { defaultCfg := DefaultECUConfig() cfg = &defaultCfg } return &ECU{ cfg: cfg, shutdown: make(chan bool), shutdownControl: make(chan bool), shutdownMonitor: make(chan bool), } }
go
func NewECU(cfg *ECUConfig) *ECU { if cfg == nil { defaultCfg := DefaultECUConfig() cfg = &defaultCfg } return &ECU{ cfg: cfg, shutdown: make(chan bool), shutdownControl: make(chan bool), shutdownMonitor: make(chan bool), } }
[ "func", "NewECU", "(", "cfg", "*", "ECUConfig", ")", "*", "ECU", "{", "if", "cfg", "==", "nil", "{", "defaultCfg", ":=", "DefaultECUConfig", "(", ")", "\n", "cfg", "=", "&", "defaultCfg", "\n", "}", "\n", "return", "&", "ECU", "{", "cfg", ":", "cfg...
// NewECU returns an initialised ECU struct.
[ "NewECU", "returns", "an", "initialised", "ECU", "struct", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/core.go#L77-L88
train
google/seesaw
ecu/core.go
Run
func (e *ECU) Run() { if err := e.authInit(); err != nil { log.Warningf("Failed to initialise authentication, remote control will likely fail: %v", err) } stats := newECUStats(e) go stats.run() go e.control() go e.monitoring() <-e.shutdown e.shutdownControl <- true e.shutdownMonitor <- true <-e.shutdownC...
go
func (e *ECU) Run() { if err := e.authInit(); err != nil { log.Warningf("Failed to initialise authentication, remote control will likely fail: %v", err) } stats := newECUStats(e) go stats.run() go e.control() go e.monitoring() <-e.shutdown e.shutdownControl <- true e.shutdownMonitor <- true <-e.shutdownC...
[ "func", "(", "e", "*", "ECU", ")", "Run", "(", ")", "{", "if", "err", ":=", "e", ".", "authInit", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Warningf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "stats", ":=", "newECUStats...
// Run starts the ECU.
[ "Run", "starts", "the", "ECU", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/core.go#L91-L107
train
google/seesaw
ecu/core.go
monitoring
func (e *ECU) monitoring() { ln, err := net.Listen("tcp", e.cfg.MonitorAddress) if err != nil { log.Fatal("listen error:", err) } monitorHTTP := &http.Server{ ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, MaxHeaderBytes: 1 << 20, } go monitorHTTP.Serve(ln) <-e.shutdownMonitor ln....
go
func (e *ECU) monitoring() { ln, err := net.Listen("tcp", e.cfg.MonitorAddress) if err != nil { log.Fatal("listen error:", err) } monitorHTTP := &http.Server{ ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, MaxHeaderBytes: 1 << 20, } go monitorHTTP.Serve(ln) <-e.shutdownMonitor ln....
[ "func", "(", "e", "*", "ECU", ")", "monitoring", "(", ")", "{", "ln", ",", "err", ":=", "net", ".", "Listen", "(", "\"", "\"", ",", "e", ".", "cfg", ".", "MonitorAddress", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "\...
// monitoring starts an HTTP server for monitoring purposes.
[ "monitoring", "starts", "an", "HTTP", "server", "for", "monitoring", "purposes", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/core.go#L115-L131
train
google/seesaw
ecu/core.go
controlTLSConfig
func (e *ECU) controlTLSConfig() (*tls.Config, error) { rootCACerts := x509.NewCertPool() data, err := ioutil.ReadFile(e.cfg.CACertsFile) if err != nil { return nil, fmt.Errorf("failed to read CA cert file: %v", err) } if ok := rootCACerts.AppendCertsFromPEM(data); !ok { return nil, errors.New("failed to load ...
go
func (e *ECU) controlTLSConfig() (*tls.Config, error) { rootCACerts := x509.NewCertPool() data, err := ioutil.ReadFile(e.cfg.CACertsFile) if err != nil { return nil, fmt.Errorf("failed to read CA cert file: %v", err) } if ok := rootCACerts.AppendCertsFromPEM(data); !ok { return nil, errors.New("failed to load ...
[ "func", "(", "e", "*", "ECU", ")", "controlTLSConfig", "(", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "rootCACerts", ":=", "x509", ".", "NewCertPool", "(", ")", "\n", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "e",...
// controlTLSConfig returns a TLS configuration for use by the control server.
[ "controlTLSConfig", "returns", "a", "TLS", "configuration", "for", "use", "by", "the", "control", "server", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/core.go#L134-L154
train
google/seesaw
ecu/core.go
control
func (e *ECU) control() { tlsConfig, err := e.controlTLSConfig() if err != nil { log.Errorf("Disabling ECU control server: %v", err) <-e.shutdownControl e.shutdownControl <- true return } ln, err := net.Listen("tcp", e.cfg.ControlAddress) if err != nil { log.Fatal("listen error:", err) } seesawRPC :=...
go
func (e *ECU) control() { tlsConfig, err := e.controlTLSConfig() if err != nil { log.Errorf("Disabling ECU control server: %v", err) <-e.shutdownControl e.shutdownControl <- true return } ln, err := net.Listen("tcp", e.cfg.ControlAddress) if err != nil { log.Fatal("listen error:", err) } seesawRPC :=...
[ "func", "(", "e", "*", "ECU", ")", "control", "(", ")", "{", "tlsConfig", ",", "err", ":=", "e", ".", "controlTLSConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "<-", "e", ...
// control starts an HTTP server to handle control RPC via a TCP socket. This // interface is used to control the Seesaw Node via the CLI or web console.
[ "control", "starts", "an", "HTTP", "server", "to", "handle", "control", "RPC", "via", "a", "TCP", "socket", ".", "This", "interface", "is", "used", "to", "control", "the", "Seesaw", "Node", "via", "the", "CLI", "or", "web", "console", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ecu/core.go#L158-L180
train
google/seesaw
ncc/sysctl.go
sysctlInitLB
func sysctlInitLB(nodeIface, lbIface *net.Interface) error { // System level sysctls. for _, ctl := range seesawSysctls { if _, err := sysctl(ctl.name, ctl.value); err != nil { return err } } // Interface level sysctls. ifaces := []string{"all", "default", nodeIface.Name, lbIface.Name} for _, iface := ra...
go
func sysctlInitLB(nodeIface, lbIface *net.Interface) error { // System level sysctls. for _, ctl := range seesawSysctls { if _, err := sysctl(ctl.name, ctl.value); err != nil { return err } } // Interface level sysctls. ifaces := []string{"all", "default", nodeIface.Name, lbIface.Name} for _, iface := ra...
[ "func", "sysctlInitLB", "(", "nodeIface", ",", "lbIface", "*", "net", ".", "Interface", ")", "error", "{", "// System level sysctls.", "for", "_", ",", "ctl", ":=", "range", "seesawSysctls", "{", "if", "_", ",", "err", ":=", "sysctl", "(", "ctl", ".", "n...
// sysctlInitLB initialises sysctls required for load balancing.
[ "sysctlInitLB", "initialises", "sysctls", "required", "for", "load", "balancing", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/sysctl.go#L91-L108
train
google/seesaw
ncc/sysctl.go
sysctlInitIface
func sysctlInitIface(iface string) error { for _, ctl := range seesawIfaceSysctls { if err := sysctlIface(iface, ctl.af, ctl.name, ctl.value); err != nil { return err } } return nil }
go
func sysctlInitIface(iface string) error { for _, ctl := range seesawIfaceSysctls { if err := sysctlIface(iface, ctl.af, ctl.name, ctl.value); err != nil { return err } } return nil }
[ "func", "sysctlInitIface", "(", "iface", "string", ")", "error", "{", "for", "_", ",", "ctl", ":=", "range", "seesawIfaceSysctls", "{", "if", "err", ":=", "sysctlIface", "(", "iface", ",", "ctl", ".", "af", ",", "ctl", ".", "name", ",", "ctl", ".", "...
// sysctlInitIface initialises sysctls required for a load balancing interface.
[ "sysctlInitIface", "initialises", "sysctls", "required", "for", "a", "load", "balancing", "interface", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/sysctl.go#L111-L118
train
google/seesaw
ncc/sysctl.go
sysctlIface
func sysctlIface(iface string, af seesaw.AF, name, value string) error { components := []string{ "net", strings.ToLower(af.String()), "conf", iface, name, } _, err := sysctlByComponents(components, value) return err }
go
func sysctlIface(iface string, af seesaw.AF, name, value string) error { components := []string{ "net", strings.ToLower(af.String()), "conf", iface, name, } _, err := sysctlByComponents(components, value) return err }
[ "func", "sysctlIface", "(", "iface", "string", ",", "af", "seesaw", ".", "AF", ",", "name", ",", "value", "string", ")", "error", "{", "components", ":=", "[", "]", "string", "{", "\"", "\"", ",", "strings", ".", "ToLower", "(", "af", ".", "String", ...
// sysctlIface sets a sysctl for a given address family and network interface.
[ "sysctlIface", "sets", "a", "sysctl", "for", "a", "given", "address", "family", "and", "network", "interface", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/sysctl.go#L121-L127
train
google/seesaw
ncc/sysctl.go
sysctl
func sysctl(name, value string) (string, error) { return sysctlByComponents(strings.Split(name, "."), value) }
go
func sysctl(name, value string) (string, error) { return sysctlByComponents(strings.Split(name, "."), value) }
[ "func", "sysctl", "(", "name", ",", "value", "string", ")", "(", "string", ",", "error", ")", "{", "return", "sysctlByComponents", "(", "strings", ".", "Split", "(", "name", ",", "\"", "\"", ")", ",", "value", ")", "\n", "}" ]
// sysctl sets the named sysctl to the value specified and returns its // original value as a string. Note that this cannot be used if a sysctl // component includes a period it its name - in that case use // sysctlByComponents instead.
[ "sysctl", "sets", "the", "named", "sysctl", "to", "the", "value", "specified", "and", "returns", "its", "original", "value", "as", "a", "string", ".", "Note", "that", "this", "cannot", "be", "used", "if", "a", "sysctl", "component", "includes", "a", "perio...
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/sysctl.go#L133-L135
train
google/seesaw
ncc/sysctl.go
sysctlByComponents
func sysctlByComponents(components []string, value string) (string, error) { components = append([]string{sysctlPath}, components...) f, err := os.OpenFile(path.Join(components...), os.O_RDWR, 0) if err != nil { return "", err } defer f.Close() b, err := ioutil.ReadAll(f) if err != nil { return "", err } i...
go
func sysctlByComponents(components []string, value string) (string, error) { components = append([]string{sysctlPath}, components...) f, err := os.OpenFile(path.Join(components...), os.O_RDWR, 0) if err != nil { return "", err } defer f.Close() b, err := ioutil.ReadAll(f) if err != nil { return "", err } i...
[ "func", "sysctlByComponents", "(", "components", "[", "]", "string", ",", "value", "string", ")", "(", "string", ",", "error", ")", "{", "components", "=", "append", "(", "[", "]", "string", "{", "sysctlPath", "}", ",", "components", "...", ")", "\n", ...
// sysctlByComponents sets the sysctl specified by the individual components // to the value specified and returns its original value as a string.
[ "sysctlByComponents", "sets", "the", "sysctl", "specified", "by", "the", "individual", "components", "to", "the", "value", "specified", "and", "returns", "its", "original", "value", "as", "a", "string", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/sysctl.go#L139-L157
train
google/seesaw
ncc/iptables.go
newIPTRuleTemplate
func newIPTRuleTemplate(action iptAction, tmpl string) *iptRuleTemplate { t, err := template.New("").Parse(tmpl) if err != nil { panic(fmt.Sprintf("Failed to parse iptables template: %q: %v", tmpl, err)) } return &iptRuleTemplate{action, t} }
go
func newIPTRuleTemplate(action iptAction, tmpl string) *iptRuleTemplate { t, err := template.New("").Parse(tmpl) if err != nil { panic(fmt.Sprintf("Failed to parse iptables template: %q: %v", tmpl, err)) } return &iptRuleTemplate{action, t} }
[ "func", "newIPTRuleTemplate", "(", "action", "iptAction", ",", "tmpl", "string", ")", "*", "iptRuleTemplate", "{", "t", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "tmpl", ")", "\n", "if", "err", "!=", "nil", "{...
// newIPTRuleTemplate creates a new iptRuleTemplate.
[ "newIPTRuleTemplate", "creates", "a", "new", "iptRuleTemplate", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/iptables.go#L77-L83
train
google/seesaw
ncc/iptables.go
execute
func (te *iptTemplateExecuter) execute() ([]*iptRule, error) { rules := make([]*iptRule, 0, len(te.templates)) for _, t := range te.templates { w := new(bytes.Buffer) if err := t.Template.Execute(w, te.data); err != nil { return nil, err } af := seesaw.IPv6 if te.data.ServiceVIP.To4() != nil { af = se...
go
func (te *iptTemplateExecuter) execute() ([]*iptRule, error) { rules := make([]*iptRule, 0, len(te.templates)) for _, t := range te.templates { w := new(bytes.Buffer) if err := t.Template.Execute(w, te.data); err != nil { return nil, err } af := seesaw.IPv6 if te.data.ServiceVIP.To4() != nil { af = se...
[ "func", "(", "te", "*", "iptTemplateExecuter", ")", "execute", "(", ")", "(", "[", "]", "*", "iptRule", ",", "error", ")", "{", "rules", ":=", "make", "(", "[", "]", "*", "iptRule", ",", "0", ",", "len", "(", "te", ".", "templates", ")", ")", "...
// execute generates the list of iptRules for this iptTemplateExecuter.
[ "execute", "generates", "the", "list", "of", "iptRules", "for", "this", "iptTemplateExecuter", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/iptables.go#L103-L122
train
google/seesaw
ncc/iptables.go
initIPTRuleTemplates
func initIPTRuleTemplates() { // Allow traffic for VIP services. svcRules = append(svcRules, newIPTRuleTemplate(iptAppend, "INPUT -p {{.Proto}} -d {{.ServiceVIP}}{{with .Port}} --dport {{.}}{{end}} -j ACCEPT")) // Mark packets for firemark based VIPs. fwmRule := "PREROUTING -t mangle -p {{.Proto}} -d {{.ServiceV...
go
func initIPTRuleTemplates() { // Allow traffic for VIP services. svcRules = append(svcRules, newIPTRuleTemplate(iptAppend, "INPUT -p {{.Proto}} -d {{.ServiceVIP}}{{with .Port}} --dport {{.}}{{end}} -j ACCEPT")) // Mark packets for firemark based VIPs. fwmRule := "PREROUTING -t mangle -p {{.Proto}} -d {{.ServiceV...
[ "func", "initIPTRuleTemplates", "(", ")", "{", "// Allow traffic for VIP services.", "svcRules", "=", "append", "(", "svcRules", ",", "newIPTRuleTemplate", "(", "iptAppend", ",", "\"", "\"", ")", ")", "\n\n", "// Mark packets for firemark based VIPs.", "fwmRule", ":=", ...
// initIPTRuleTemplates initialises the iptRuleTemplates.
[ "initIPTRuleTemplates", "initialises", "the", "iptRuleTemplates", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/iptables.go#L132-L162
train
google/seesaw
ncc/iptables.go
iptablesInit
func iptablesInit(clusterVIP seesaw.Host) error { if err := iptablesFlush(); err != nil { return err } for _, af := range seesaw.AFs() { // Allow connections to port 10257 for all VIPs. if err := iptablesRun(af, "-I INPUT -p tcp --dport 10257 -j ACCEPT"); err != nil { return err } // conntrack is only ...
go
func iptablesInit(clusterVIP seesaw.Host) error { if err := iptablesFlush(); err != nil { return err } for _, af := range seesaw.AFs() { // Allow connections to port 10257 for all VIPs. if err := iptablesRun(af, "-I INPUT -p tcp --dport 10257 -j ACCEPT"); err != nil { return err } // conntrack is only ...
[ "func", "iptablesInit", "(", "clusterVIP", "seesaw", ".", "Host", ")", "error", "{", "if", "err", ":=", "iptablesFlush", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "af", ":=", "range", "seesaw", ".", ...
// iptablesInit initialises the iptables rules for a Seesaw Node.
[ "iptablesInit", "initialises", "the", "iptables", "rules", "for", "a", "Seesaw", "Node", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/iptables.go#L216-L239
train
google/seesaw
ncc/iptables.go
iptablesFlush
func iptablesFlush() error { for _, af := range seesaw.AFs() { for _, table := range []string{"filter", "mangle", "raw"} { if err := iptablesRun(af, fmt.Sprintf("--flush -t %v", table)); err != nil { return err } } } // NAT is IPv4-only until linux kernel version 3.7. // TODO(angusc): Support IPv6 NAT...
go
func iptablesFlush() error { for _, af := range seesaw.AFs() { for _, table := range []string{"filter", "mangle", "raw"} { if err := iptablesRun(af, fmt.Sprintf("--flush -t %v", table)); err != nil { return err } } } // NAT is IPv4-only until linux kernel version 3.7. // TODO(angusc): Support IPv6 NAT...
[ "func", "iptablesFlush", "(", ")", "error", "{", "for", "_", ",", "af", ":=", "range", "seesaw", ".", "AFs", "(", ")", "{", "for", "_", ",", "table", ":=", "range", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", "...
// iptablesFlush removes all IPv4 and IPv6 iptables rules.
[ "iptablesFlush", "removes", "all", "IPv4", "and", "IPv6", "iptables", "rules", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/iptables.go#L242-L256
train
google/seesaw
ncc/iptables.go
iptablesRules
func iptablesRules(v *seesaw.Vserver, clusterVIP seesaw.Host, af seesaw.AF) ([]*iptRule, error) { var clusterIP, serviceIP net.IP switch af { case seesaw.IPv4: clusterIP = clusterVIP.IPv4Addr serviceIP = v.IPv4Addr case seesaw.IPv6: clusterIP = clusterVIP.IPv6Addr serviceIP = v.IPv6Addr } if clusterIP == ...
go
func iptablesRules(v *seesaw.Vserver, clusterVIP seesaw.Host, af seesaw.AF) ([]*iptRule, error) { var clusterIP, serviceIP net.IP switch af { case seesaw.IPv4: clusterIP = clusterVIP.IPv4Addr serviceIP = v.IPv4Addr case seesaw.IPv6: clusterIP = clusterVIP.IPv6Addr serviceIP = v.IPv6Addr } if clusterIP == ...
[ "func", "iptablesRules", "(", "v", "*", "seesaw", ".", "Vserver", ",", "clusterVIP", "seesaw", ".", "Host", ",", "af", "seesaw", ".", "AF", ")", "(", "[", "]", "*", "iptRule", ",", "error", ")", "{", "var", "clusterIP", ",", "serviceIP", "net", ".", ...
// iptablesRules returns the list of iptRules for a Vserver.
[ "iptablesRules", "returns", "the", "list", "of", "iptRules", "for", "a", "Vserver", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/iptables.go#L259-L313
train
google/seesaw
ncc/iptables.go
iptablesAddRules
func iptablesAddRules(v *seesaw.Vserver, clusterVIP seesaw.Host, af seesaw.AF) error { rules, err := iptablesRules(v, clusterVIP, af) if err != nil { return err } for _, r := range rules { if err := iptablesRun(r.AF, string(r.action)+" "+r.rule); err != nil { return err } } return nil }
go
func iptablesAddRules(v *seesaw.Vserver, clusterVIP seesaw.Host, af seesaw.AF) error { rules, err := iptablesRules(v, clusterVIP, af) if err != nil { return err } for _, r := range rules { if err := iptablesRun(r.AF, string(r.action)+" "+r.rule); err != nil { return err } } return nil }
[ "func", "iptablesAddRules", "(", "v", "*", "seesaw", ".", "Vserver", ",", "clusterVIP", "seesaw", ".", "Host", ",", "af", "seesaw", ".", "AF", ")", "error", "{", "rules", ",", "err", ":=", "iptablesRules", "(", "v", ",", "clusterVIP", ",", "af", ")", ...
// iptablesAddRules installs the iptables rules for a given Vserver and Seesaw // Cluster VIP.
[ "iptablesAddRules", "installs", "the", "iptables", "rules", "for", "a", "given", "Vserver", "and", "Seesaw", "Cluster", "VIP", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/iptables.go#L317-L328
train
google/seesaw
ncc/ipvs.go
initIPVS
func initIPVS() { ipvsMutex.Lock() defer ipvsMutex.Unlock() log.Infof("Initialising IPVS...") if err := ipvs.Init(); err != nil { // TODO(jsing): modprobe ip_vs and try again. log.Fatalf("IPVS initialisation failed: %v", err) } log.Infof("IPVS version %s", ipvs.Version()) }
go
func initIPVS() { ipvsMutex.Lock() defer ipvsMutex.Unlock() log.Infof("Initialising IPVS...") if err := ipvs.Init(); err != nil { // TODO(jsing): modprobe ip_vs and try again. log.Fatalf("IPVS initialisation failed: %v", err) } log.Infof("IPVS version %s", ipvs.Version()) }
[ "func", "initIPVS", "(", ")", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", "\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "ipvs", ".", "Init", "(", ")", ";", "err", "!=...
// initIPVS initialises the IPVS sub-component.
[ "initIPVS", "initialises", "the", "IPVS", "sub", "-", "component", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L34-L43
train
google/seesaw
ncc/ipvs.go
IPVSFlush
func (ncc *SeesawNCC) IPVSFlush(in int, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.Flush() }
go
func (ncc *SeesawNCC) IPVSFlush(in int, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.Flush() }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSFlush", "(", "in", "int", ",", "out", "*", "int", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", "\n", "return", "ipvs", ".", "Flush", "(",...
// IPVSFlush flushes all services and destinations from the IPVS table.
[ "IPVSFlush", "flushes", "all", "services", "and", "destinations", "from", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L46-L50
train
google/seesaw
ncc/ipvs.go
IPVSGetServices
func (ncc *SeesawNCC) IPVSGetServices(in int, s *ncctypes.IPVSServices) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() svcs, err := ipvs.GetServices() if err != nil { return err } s.Services = nil for _, svc := range svcs { s.Services = append(s.Services, svc) } return nil }
go
func (ncc *SeesawNCC) IPVSGetServices(in int, s *ncctypes.IPVSServices) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() svcs, err := ipvs.GetServices() if err != nil { return err } s.Services = nil for _, svc := range svcs { s.Services = append(s.Services, svc) } return nil }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSGetServices", "(", "in", "int", ",", "s", "*", "ncctypes", ".", "IPVSServices", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", "\n", "svcs", ...
// IPVSGetServices gets the currently configured services from the IPVS table.
[ "IPVSGetServices", "gets", "the", "currently", "configured", "services", "from", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L53-L65
train
google/seesaw
ncc/ipvs.go
IPVSGetService
func (ncc *SeesawNCC) IPVSGetService(si *ipvs.Service, s *ncctypes.IPVSServices) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() so, err := ipvs.GetService(si) if err != nil { return err } s.Services = []*ipvs.Service{so} return nil }
go
func (ncc *SeesawNCC) IPVSGetService(si *ipvs.Service, s *ncctypes.IPVSServices) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() so, err := ipvs.GetService(si) if err != nil { return err } s.Services = []*ipvs.Service{so} return nil }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSGetService", "(", "si", "*", "ipvs", ".", "Service", ",", "s", "*", "ncctypes", ".", "IPVSServices", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ...
// IPVSGetService gets the currently configured service from the IPVS table, // which matches the specified service.
[ "IPVSGetService", "gets", "the", "currently", "configured", "service", "from", "the", "IPVS", "table", "which", "matches", "the", "specified", "service", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L69-L78
train
google/seesaw
ncc/ipvs.go
IPVSAddService
func (ncc *SeesawNCC) IPVSAddService(svc *ipvs.Service, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.AddService(*svc) }
go
func (ncc *SeesawNCC) IPVSAddService(svc *ipvs.Service, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.AddService(*svc) }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSAddService", "(", "svc", "*", "ipvs", ".", "Service", ",", "out", "*", "int", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", "\n", "return", ...
// IPVSAddService adds the specified service to the IPVS table.
[ "IPVSAddService", "adds", "the", "specified", "service", "to", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L81-L85
train
google/seesaw
ncc/ipvs.go
IPVSUpdateService
func (ncc *SeesawNCC) IPVSUpdateService(svc *ipvs.Service, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.UpdateService(*svc) }
go
func (ncc *SeesawNCC) IPVSUpdateService(svc *ipvs.Service, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.UpdateService(*svc) }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSUpdateService", "(", "svc", "*", "ipvs", ".", "Service", ",", "out", "*", "int", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", "\n", "return...
// IPVSUpdateService updates the specified service in the IPVS table.
[ "IPVSUpdateService", "updates", "the", "specified", "service", "in", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L88-L92
train
google/seesaw
ncc/ipvs.go
IPVSDeleteService
func (ncc *SeesawNCC) IPVSDeleteService(svc *ipvs.Service, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.DeleteService(*svc) }
go
func (ncc *SeesawNCC) IPVSDeleteService(svc *ipvs.Service, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.DeleteService(*svc) }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSDeleteService", "(", "svc", "*", "ipvs", ".", "Service", ",", "out", "*", "int", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", "\n", "return...
// IPVSDeleteService deletes the specified service from the IPVS table.
[ "IPVSDeleteService", "deletes", "the", "specified", "service", "from", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L95-L99
train
google/seesaw
ncc/ipvs.go
IPVSAddDestination
func (ncc *SeesawNCC) IPVSAddDestination(dst *ncctypes.IPVSDestination, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.AddDestination(*dst.Service, *dst.Destination) }
go
func (ncc *SeesawNCC) IPVSAddDestination(dst *ncctypes.IPVSDestination, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.AddDestination(*dst.Service, *dst.Destination) }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSAddDestination", "(", "dst", "*", "ncctypes", ".", "IPVSDestination", ",", "out", "*", "int", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", "\...
// IPVSAddDestination adds the specified destination to the IPVS table.
[ "IPVSAddDestination", "adds", "the", "specified", "destination", "to", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L102-L106
train
google/seesaw
ncc/ipvs.go
IPVSUpdateDestination
func (ncc *SeesawNCC) IPVSUpdateDestination(dst *ncctypes.IPVSDestination, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.UpdateDestination(*dst.Service, *dst.Destination) }
go
func (ncc *SeesawNCC) IPVSUpdateDestination(dst *ncctypes.IPVSDestination, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.UpdateDestination(*dst.Service, *dst.Destination) }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSUpdateDestination", "(", "dst", "*", "ncctypes", ".", "IPVSDestination", ",", "out", "*", "int", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", ...
// IPVSUpdateDestination updates the specified destination in the IPVS table.
[ "IPVSUpdateDestination", "updates", "the", "specified", "destination", "in", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L109-L113
train
google/seesaw
ncc/ipvs.go
IPVSDeleteDestination
func (ncc *SeesawNCC) IPVSDeleteDestination(dst *ncctypes.IPVSDestination, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.DeleteDestination(*dst.Service, *dst.Destination) }
go
func (ncc *SeesawNCC) IPVSDeleteDestination(dst *ncctypes.IPVSDestination, out *int) error { ipvsMutex.Lock() defer ipvsMutex.Unlock() return ipvs.DeleteDestination(*dst.Service, *dst.Destination) }
[ "func", "(", "ncc", "*", "SeesawNCC", ")", "IPVSDeleteDestination", "(", "dst", "*", "ncctypes", ".", "IPVSDestination", ",", "out", "*", "int", ")", "error", "{", "ipvsMutex", ".", "Lock", "(", ")", "\n", "defer", "ipvsMutex", ".", "Unlock", "(", ")", ...
// IPVSDeleteDestination deletes the specified destination from the IPVS table.
[ "IPVSDeleteDestination", "deletes", "the", "specified", "destination", "from", "the", "IPVS", "table", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/ncc/ipvs.go#L116-L120
train
google/seesaw
common/seesaw/util.go
Copy
func (n *Node) Copy(c *Node) { n.State = c.State n.Priority = c.Priority n.Host.Copy(&c.Host) n.VserversEnabled = c.VserversEnabled }
go
func (n *Node) Copy(c *Node) { n.State = c.State n.Priority = c.Priority n.Host.Copy(&c.Host) n.VserversEnabled = c.VserversEnabled }
[ "func", "(", "n", "*", "Node", ")", "Copy", "(", "c", "*", "Node", ")", "{", "n", ".", "State", "=", "c", ".", "State", "\n", "n", ".", "Priority", "=", "c", ".", "Priority", "\n", "n", ".", "Host", ".", "Copy", "(", "&", "c", ".", "Host", ...
// Copy deep copies from the given Seesaw Node.
[ "Copy", "deep", "copies", "from", "the", "given", "Seesaw", "Node", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L38-L43
train
google/seesaw
common/seesaw/util.go
Clone
func (n *Node) Clone() *Node { var c Node c.Copy(n) return &c }
go
func (n *Node) Clone() *Node { var c Node c.Copy(n) return &c }
[ "func", "(", "n", "*", "Node", ")", "Clone", "(", ")", "*", "Node", "{", "var", "c", "Node", "\n", "c", ".", "Copy", "(", "n", ")", "\n", "return", "&", "c", "\n", "}" ]
// Clone creates an identical copy of the given Seesaw Node.
[ "Clone", "creates", "an", "identical", "copy", "of", "the", "given", "Seesaw", "Node", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L46-L50
train
google/seesaw
common/seesaw/util.go
Copy
func (h *Host) Copy(c *Host) { h.Hostname = c.Hostname h.IPv4Addr = copyIP(c.IPv4Addr) h.IPv4Mask = copyIPMask(c.IPv4Mask) h.IPv6Addr = copyIP(c.IPv6Addr) h.IPv6Mask = copyIPMask(c.IPv6Mask) }
go
func (h *Host) Copy(c *Host) { h.Hostname = c.Hostname h.IPv4Addr = copyIP(c.IPv4Addr) h.IPv4Mask = copyIPMask(c.IPv4Mask) h.IPv6Addr = copyIP(c.IPv6Addr) h.IPv6Mask = copyIPMask(c.IPv6Mask) }
[ "func", "(", "h", "*", "Host", ")", "Copy", "(", "c", "*", "Host", ")", "{", "h", ".", "Hostname", "=", "c", ".", "Hostname", "\n", "h", ".", "IPv4Addr", "=", "copyIP", "(", "c", ".", "IPv4Addr", ")", "\n", "h", ".", "IPv4Mask", "=", "copyIPMas...
// Copy deep copies from the given Seesaw Host.
[ "Copy", "deep", "copies", "from", "the", "given", "Seesaw", "Host", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L75-L81
train
google/seesaw
common/seesaw/util.go
Clone
func (h *Host) Clone() *Host { var c Host c.Copy(h) return &c }
go
func (h *Host) Clone() *Host { var c Host c.Copy(h) return &c }
[ "func", "(", "h", "*", "Host", ")", "Clone", "(", ")", "*", "Host", "{", "var", "c", "Host", "\n", "c", ".", "Copy", "(", "h", ")", "\n", "return", "&", "c", "\n", "}" ]
// Clone creates an identical copy of the given Seesaw Host.
[ "Clone", "creates", "an", "identical", "copy", "of", "the", "given", "Seesaw", "Host", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L84-L88
train
google/seesaw
common/seesaw/util.go
Equal
func (h *Host) Equal(other *Host) bool { return reflect.DeepEqual(h, other) }
go
func (h *Host) Equal(other *Host) bool { return reflect.DeepEqual(h, other) }
[ "func", "(", "h", "*", "Host", ")", "Equal", "(", "other", "*", "Host", ")", "bool", "{", "return", "reflect", ".", "DeepEqual", "(", "h", ",", "other", ")", "\n", "}" ]
// Equal returns whether two hosts are equal.
[ "Equal", "returns", "whether", "two", "hosts", "are", "equal", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L91-L93
train
google/seesaw
common/seesaw/util.go
IPv4Net
func (h *Host) IPv4Net() *net.IPNet { return &net.IPNet{IP: h.IPv4Addr, Mask: h.IPv4Mask} }
go
func (h *Host) IPv4Net() *net.IPNet { return &net.IPNet{IP: h.IPv4Addr, Mask: h.IPv4Mask} }
[ "func", "(", "h", "*", "Host", ")", "IPv4Net", "(", ")", "*", "net", ".", "IPNet", "{", "return", "&", "net", ".", "IPNet", "{", "IP", ":", "h", ".", "IPv4Addr", ",", "Mask", ":", "h", ".", "IPv4Mask", "}", "\n", "}" ]
// IPv4Net returns a net.IPNet for the host's IPv4 address.
[ "IPv4Net", "returns", "a", "net", ".", "IPNet", "for", "the", "host", "s", "IPv4", "address", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L96-L98
train
google/seesaw
common/seesaw/util.go
IPv6Net
func (h *Host) IPv6Net() *net.IPNet { return &net.IPNet{IP: h.IPv6Addr, Mask: h.IPv6Mask} }
go
func (h *Host) IPv6Net() *net.IPNet { return &net.IPNet{IP: h.IPv6Addr, Mask: h.IPv6Mask} }
[ "func", "(", "h", "*", "Host", ")", "IPv6Net", "(", ")", "*", "net", ".", "IPNet", "{", "return", "&", "net", ".", "IPNet", "{", "IP", ":", "h", ".", "IPv6Addr", ",", "Mask", ":", "h", ".", "IPv6Mask", "}", "\n", "}" ]
// IPv6Net returns a net.IPNet for the host's IPv6 address.
[ "IPv6Net", "returns", "a", "net", ".", "IPNet", "for", "the", "host", "s", "IPv6", "address", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L101-L103
train
google/seesaw
common/seesaw/util.go
IPv4Printable
func (h *Host) IPv4Printable() string { if h.IPv4Addr == nil { return "<not configured>" } return h.IPv4Net().String() }
go
func (h *Host) IPv4Printable() string { if h.IPv4Addr == nil { return "<not configured>" } return h.IPv4Net().String() }
[ "func", "(", "h", "*", "Host", ")", "IPv4Printable", "(", ")", "string", "{", "if", "h", ".", "IPv4Addr", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "h", ".", "IPv4Net", "(", ")", ".", "String", "(", ")", "\n", "}" ]
// IPv4Printable returns a printable representation of the host's IPv4 address.
[ "IPv4Printable", "returns", "a", "printable", "representation", "of", "the", "host", "s", "IPv4", "address", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L106-L111
train
google/seesaw
common/seesaw/util.go
IPv6Printable
func (h *Host) IPv6Printable() string { if h.IPv6Addr == nil { return "<not configured>" } return h.IPv6Net().String() }
go
func (h *Host) IPv6Printable() string { if h.IPv6Addr == nil { return "<not configured>" } return h.IPv6Net().String() }
[ "func", "(", "h", "*", "Host", ")", "IPv6Printable", "(", ")", "string", "{", "if", "h", ".", "IPv6Addr", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "h", ".", "IPv6Net", "(", ")", ".", "String", "(", ")", "\n", "}" ]
// IPv6Printable returns a printable representation of the host's IPv4 address.
[ "IPv6Printable", "returns", "a", "printable", "representation", "of", "the", "host", "s", "IPv4", "address", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L114-L119
train
google/seesaw
common/seesaw/util.go
Copy
func (b *Backend) Copy(c *Backend) { b.Enabled = c.Enabled b.InService = c.InService b.Weight = c.Weight b.Host.Copy(&c.Host) }
go
func (b *Backend) Copy(c *Backend) { b.Enabled = c.Enabled b.InService = c.InService b.Weight = c.Weight b.Host.Copy(&c.Host) }
[ "func", "(", "b", "*", "Backend", ")", "Copy", "(", "c", "*", "Backend", ")", "{", "b", ".", "Enabled", "=", "c", ".", "Enabled", "\n", "b", ".", "InService", "=", "c", ".", "InService", "\n", "b", ".", "Weight", "=", "c", ".", "Weight", "\n", ...
// Copy deep copies from the given Seesaw Backend.
[ "Copy", "deep", "copies", "from", "the", "given", "Seesaw", "Backend", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L122-L127
train
google/seesaw
common/seesaw/util.go
Clone
func (b *Backend) Clone() *Backend { var c Backend c.Copy(b) return &c }
go
func (b *Backend) Clone() *Backend { var c Backend c.Copy(b) return &c }
[ "func", "(", "b", "*", "Backend", ")", "Clone", "(", ")", "*", "Backend", "{", "var", "c", "Backend", "\n", "c", ".", "Copy", "(", "b", ")", "\n", "return", "&", "c", "\n", "}" ]
// Clone creates an identical copy of the given Seesaw Backend.
[ "Clone", "creates", "an", "identical", "copy", "of", "the", "given", "Seesaw", "Backend", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L130-L134
train
google/seesaw
common/seesaw/util.go
Copy
func (h *HAConfig) Copy(c *HAConfig) { h.Enabled = c.Enabled h.LocalAddr = copyIP(c.LocalAddr) h.RemoteAddr = copyIP(c.RemoteAddr) h.Priority = c.Priority h.VRID = c.VRID }
go
func (h *HAConfig) Copy(c *HAConfig) { h.Enabled = c.Enabled h.LocalAddr = copyIP(c.LocalAddr) h.RemoteAddr = copyIP(c.RemoteAddr) h.Priority = c.Priority h.VRID = c.VRID }
[ "func", "(", "h", "*", "HAConfig", ")", "Copy", "(", "c", "*", "HAConfig", ")", "{", "h", ".", "Enabled", "=", "c", ".", "Enabled", "\n", "h", ".", "LocalAddr", "=", "copyIP", "(", "c", ".", "LocalAddr", ")", "\n", "h", ".", "RemoteAddr", "=", ...
// Copy deep copies from the given Seesaw HAConfig.
[ "Copy", "deep", "copies", "from", "the", "given", "Seesaw", "HAConfig", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L142-L148
train
google/seesaw
common/seesaw/util.go
Clone
func (h *HAConfig) Clone() *HAConfig { var c HAConfig c.Copy(h) return &c }
go
func (h *HAConfig) Clone() *HAConfig { var c HAConfig c.Copy(h) return &c }
[ "func", "(", "h", "*", "HAConfig", ")", "Clone", "(", ")", "*", "HAConfig", "{", "var", "c", "HAConfig", "\n", "c", ".", "Copy", "(", "h", ")", "\n", "return", "&", "c", "\n", "}" ]
// Clone creates an identical copy of the given Seesaw HAConfig.
[ "Clone", "creates", "an", "identical", "copy", "of", "the", "given", "Seesaw", "HAConfig", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L151-L155
train
google/seesaw
common/seesaw/util.go
Equal
func (h *HAConfig) Equal(other *HAConfig) bool { return h.Enabled == other.Enabled && h.LocalAddr.Equal(other.LocalAddr) && h.RemoteAddr.Equal(other.RemoteAddr) && h.Priority == other.Priority && h.VRID == other.VRID }
go
func (h *HAConfig) Equal(other *HAConfig) bool { return h.Enabled == other.Enabled && h.LocalAddr.Equal(other.LocalAddr) && h.RemoteAddr.Equal(other.RemoteAddr) && h.Priority == other.Priority && h.VRID == other.VRID }
[ "func", "(", "h", "*", "HAConfig", ")", "Equal", "(", "other", "*", "HAConfig", ")", "bool", "{", "return", "h", ".", "Enabled", "==", "other", ".", "Enabled", "&&", "h", ".", "LocalAddr", ".", "Equal", "(", "other", ".", "LocalAddr", ")", "&&", "h...
// Equal reports whether this HAConfig is equal to the given HAConfig.
[ "Equal", "reports", "whether", "this", "HAConfig", "is", "equal", "to", "the", "given", "HAConfig", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L158-L164
train
google/seesaw
common/seesaw/util.go
String
func (h HAConfig) String() string { return fmt.Sprintf("Enabled: %v, LocalAddr: %v, RemoteAddr: %v, Priority: %d, VRID: %d", h.Enabled, h.LocalAddr, h.RemoteAddr, h.Priority, h.VRID) }
go
func (h HAConfig) String() string { return fmt.Sprintf("Enabled: %v, LocalAddr: %v, RemoteAddr: %v, Priority: %d, VRID: %d", h.Enabled, h.LocalAddr, h.RemoteAddr, h.Priority, h.VRID) }
[ "func", "(", "h", "HAConfig", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "h", ".", "Enabled", ",", "h", ".", "LocalAddr", ",", "h", ".", "RemoteAddr", ",", "h", ".", "Priority", ",", "h", ".", ...
// String returns the string representation of an HAConfig.
[ "String", "returns", "the", "string", "representation", "of", "an", "HAConfig", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L167-L170
train
google/seesaw
common/seesaw/util.go
String
func (h HAState) String() string { switch h { case HAUnknown: return "Unknown" case HABackup: return "Backup" case HADisabled: return "Disabled" case HAError: return "Error" case HAMaster: return "Master" case HAShutdown: return "Shutdown" } return "(invalid)" }
go
func (h HAState) String() string { switch h { case HAUnknown: return "Unknown" case HABackup: return "Backup" case HADisabled: return "Disabled" case HAError: return "Error" case HAMaster: return "Master" case HAShutdown: return "Shutdown" } return "(invalid)" }
[ "func", "(", "h", "HAState", ")", "String", "(", ")", "string", "{", "switch", "h", "{", "case", "HAUnknown", ":", "return", "\"", "\"", "\n", "case", "HABackup", ":", "return", "\"", "\"", "\n", "case", "HADisabled", ":", "return", "\"", "\"", "\n",...
// String returns the string representation of an HAState.
[ "String", "returns", "the", "string", "representation", "of", "an", "HAState", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L173-L189
train
google/seesaw
common/seesaw/util.go
Equal
func (v *VLAN) Equal(other *VLAN) bool { // Exclude backend and VIP counters from comparison. return v.ID == other.ID && v.Host.Equal(&other.Host) }
go
func (v *VLAN) Equal(other *VLAN) bool { // Exclude backend and VIP counters from comparison. return v.ID == other.ID && v.Host.Equal(&other.Host) }
[ "func", "(", "v", "*", "VLAN", ")", "Equal", "(", "other", "*", "VLAN", ")", "bool", "{", "// Exclude backend and VIP counters from comparison.", "return", "v", ".", "ID", "==", "other", ".", "ID", "&&", "v", ".", "Host", ".", "Equal", "(", "&", "other",...
// Equal reports whether this VLAN is equal to the given VLAN.
[ "Equal", "reports", "whether", "this", "VLAN", "is", "equal", "to", "the", "given", "VLAN", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L192-L195
train
google/seesaw
common/seesaw/util.go
String
func (v *VLAN) String() string { return fmt.Sprintf("{ID=%d, Host=%s, IPv4=%s, IPv6=%s}", v.ID, v.Hostname, v.IPv4Printable(), v.IPv6Printable()) }
go
func (v *VLAN) String() string { return fmt.Sprintf("{ID=%d, Host=%s, IPv4=%s, IPv6=%s}", v.ID, v.Hostname, v.IPv4Printable(), v.IPv6Printable()) }
[ "func", "(", "v", "*", "VLAN", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ".", "ID", ",", "v", ".", "Hostname", ",", "v", ".", "IPv4Printable", "(", ")", ",", "v", ".", "IPv6Printable", "...
// String returns the string representation of a VLAN.
[ "String", "returns", "the", "string", "representation", "of", "a", "VLAN", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L203-L205
train
google/seesaw
common/seesaw/util.go
String
func (sk ServiceKey) String() string { return fmt.Sprintf("%s %s %d", sk.AF, sk.Proto, sk.Port) }
go
func (sk ServiceKey) String() string { return fmt.Sprintf("%s %s %d", sk.AF, sk.Proto, sk.Port) }
[ "func", "(", "sk", "ServiceKey", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sk", ".", "AF", ",", "sk", ".", "Proto", ",", "sk", ".", "Port", ")", "\n", "}" ]
// String returns the string representation of a ServiceKey.
[ "String", "returns", "the", "string", "representation", "of", "a", "ServiceKey", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L218-L220
train
google/seesaw
common/seesaw/util.go
IP
func (d *Destination) IP(af AF) net.IP { switch af { case IPv4: return d.Backend.IPv4Addr case IPv6: return d.Backend.IPv6Addr } return nil }
go
func (d *Destination) IP(af AF) net.IP { switch af { case IPv4: return d.Backend.IPv4Addr case IPv6: return d.Backend.IPv6Addr } return nil }
[ "func", "(", "d", "*", "Destination", ")", "IP", "(", "af", "AF", ")", "net", ".", "IP", "{", "switch", "af", "{", "case", "IPv4", ":", "return", "d", ".", "Backend", ".", "IPv4Addr", "\n", "case", "IPv6", ":", "return", "d", ".", "Backend", ".",...
// IP returns the destination IP address for a given address family.
[ "IP", "returns", "the", "destination", "IP", "address", "for", "a", "given", "address", "family", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L244-L252
train
google/seesaw
common/seesaw/util.go
copyIP
func copyIP(src net.IP) net.IP { return net.IP(copyBytes(src)) }
go
func copyIP(src net.IP) net.IP { return net.IP(copyBytes(src)) }
[ "func", "copyIP", "(", "src", "net", ".", "IP", ")", "net", ".", "IP", "{", "return", "net", ".", "IP", "(", "copyBytes", "(", "src", ")", ")", "\n", "}" ]
// copyIP creates a copy of an IP.
[ "copyIP", "creates", "a", "copy", "of", "an", "IP", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L262-L264
train
google/seesaw
common/seesaw/util.go
copyIPMask
func copyIPMask(src net.IPMask) net.IPMask { return net.IPMask(copyBytes(src)) }
go
func copyIPMask(src net.IPMask) net.IPMask { return net.IPMask(copyBytes(src)) }
[ "func", "copyIPMask", "(", "src", "net", ".", "IPMask", ")", "net", ".", "IPMask", "{", "return", "net", ".", "IPMask", "(", "copyBytes", "(", "src", ")", ")", "\n", "}" ]
// copyIPMask creates a copy of an IPMask.
[ "copyIPMask", "creates", "a", "copy", "of", "an", "IPMask", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L267-L269
train
google/seesaw
common/seesaw/util.go
copyBytes
func copyBytes(src []byte) []byte { if src == nil { return nil } dst := make([]byte, len(src)) copy(dst, src) return dst }
go
func copyBytes(src []byte) []byte { if src == nil { return nil } dst := make([]byte, len(src)) copy(dst, src) return dst }
[ "func", "copyBytes", "(", "src", "[", "]", "byte", ")", "[", "]", "byte", "{", "if", "src", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "dst", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "src", ")", ")", "\n", "copy", "(", ...
// copyBytes creates a copy of a byte slice.
[ "copyBytes", "creates", "a", "copy", "of", "a", "byte", "slice", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L272-L279
train
google/seesaw
common/seesaw/util.go
IsAnycast
func IsAnycast(ip net.IP) bool { return netIPv4Anycast.Contains(ip) || netIPv6Anycast.Contains(ip) }
go
func IsAnycast(ip net.IP) bool { return netIPv4Anycast.Contains(ip) || netIPv6Anycast.Contains(ip) }
[ "func", "IsAnycast", "(", "ip", "net", ".", "IP", ")", "bool", "{", "return", "netIPv4Anycast", ".", "Contains", "(", "ip", ")", "||", "netIPv6Anycast", ".", "Contains", "(", "ip", ")", "\n", "}" ]
// IsAnycast reports whether an IP address is an anycast address.
[ "IsAnycast", "reports", "whether", "an", "IP", "address", "is", "an", "anycast", "address", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L282-L284
train
google/seesaw
common/seesaw/util.go
InSubnets
func InSubnets(ip net.IP, subnets map[string]*net.IPNet) bool { for _, subnet := range subnets { if subnet.Contains(ip) { return true } } return false }
go
func InSubnets(ip net.IP, subnets map[string]*net.IPNet) bool { for _, subnet := range subnets { if subnet.Contains(ip) { return true } } return false }
[ "func", "InSubnets", "(", "ip", "net", ".", "IP", ",", "subnets", "map", "[", "string", "]", "*", "net", ".", "IPNet", ")", "bool", "{", "for", "_", ",", "subnet", ":=", "range", "subnets", "{", "if", "subnet", ".", "Contains", "(", "ip", ")", "{...
// InSubnets reports whether an IP address is in one of a map of subnets.
[ "InSubnets", "reports", "whether", "an", "IP", "address", "is", "in", "one", "of", "a", "map", "of", "subnets", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/seesaw/util.go#L287-L294
train
google/seesaw
engine/core.go
NewEngine
func NewEngine(cfg *config.EngineConfig) *Engine { if cfg == nil { defaultCfg := config.DefaultEngineConfig() cfg = &defaultCfg } // TODO(jsing): Validate node, peer and cluster IP configuration. engine := &Engine{ config: cfg, fwmAlloc: newMarkAllocator(fwmAllocBase, fwmAllocSize), ncc: ncclient.N...
go
func NewEngine(cfg *config.EngineConfig) *Engine { if cfg == nil { defaultCfg := config.DefaultEngineConfig() cfg = &defaultCfg } // TODO(jsing): Validate node, peer and cluster IP configuration. engine := &Engine{ config: cfg, fwmAlloc: newMarkAllocator(fwmAllocBase, fwmAllocSize), ncc: ncclient.N...
[ "func", "NewEngine", "(", "cfg", "*", "config", ".", "EngineConfig", ")", "*", "Engine", "{", "if", "cfg", "==", "nil", "{", "defaultCfg", ":=", "config", ".", "DefaultEngineConfig", "(", ")", "\n", "cfg", "=", "&", "defaultCfg", "\n", "}", "\n", "// T...
// NewEngine returns an initialised Engine struct.
[ "NewEngine", "returns", "an", "initialised", "Engine", "struct", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L86-L117
train
google/seesaw
engine/core.go
Run
func (e *Engine) Run() { log.Infof("Seesaw Engine starting for %s", e.config.ClusterName) e.initNetwork() n, err := config.NewNotifier(e.config) if err != nil { log.Fatalf("config.NewNotifier() failed: %v", err) } e.notifier = n if e.config.AnycastEnabled { go e.bgpManager.run() } go e.hcManager.run() ...
go
func (e *Engine) Run() { log.Infof("Seesaw Engine starting for %s", e.config.ClusterName) e.initNetwork() n, err := config.NewNotifier(e.config) if err != nil { log.Fatalf("config.NewNotifier() failed: %v", err) } e.notifier = n if e.config.AnycastEnabled { go e.bgpManager.run() } go e.hcManager.run() ...
[ "func", "(", "e", "*", "Engine", ")", "Run", "(", ")", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "e", ".", "config", ".", "ClusterName", ")", "\n\n", "e", ".", "initNetwork", "(", ")", "\n\n", "n", ",", "err", ":=", "config", ".", "NewNot...
// Run starts the Engine.
[ "Run", "starts", "the", "Engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L120-L144
train
google/seesaw
engine/core.go
haStatus
func (e *Engine) haStatus() seesaw.HAStatus { e.haManager.statusLock.RLock() defer e.haManager.statusLock.RUnlock() return e.haManager.status }
go
func (e *Engine) haStatus() seesaw.HAStatus { e.haManager.statusLock.RLock() defer e.haManager.statusLock.RUnlock() return e.haManager.status }
[ "func", "(", "e", "*", "Engine", ")", "haStatus", "(", ")", "seesaw", ".", "HAStatus", "{", "e", ".", "haManager", ".", "statusLock", ".", "RLock", "(", ")", "\n", "defer", "e", ".", "haManager", ".", "statusLock", ".", "RUnlock", "(", ")", "\n", "...
// haStatus returns the current HA status from the engine.
[ "haStatus", "returns", "the", "current", "HA", "status", "from", "the", "engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L152-L156
train
google/seesaw
engine/core.go
setHAState
func (e *Engine) setHAState(state seesaw.HAState) { e.haManager.stateChan <- state }
go
func (e *Engine) setHAState(state seesaw.HAState) { e.haManager.stateChan <- state }
[ "func", "(", "e", "*", "Engine", ")", "setHAState", "(", "state", "seesaw", ".", "HAState", ")", "{", "e", ".", "haManager", ".", "stateChan", "<-", "state", "\n", "}" ]
// setHAState tells the engine what its current HAState should be.
[ "setHAState", "tells", "the", "engine", "what", "its", "current", "HAState", "should", "be", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L164-L166
train
google/seesaw
engine/core.go
setHAStatus
func (e *Engine) setHAStatus(status seesaw.HAStatus) { e.haManager.statusChan <- status }
go
func (e *Engine) setHAStatus(status seesaw.HAStatus) { e.haManager.statusChan <- status }
[ "func", "(", "e", "*", "Engine", ")", "setHAStatus", "(", "status", "seesaw", ".", "HAStatus", ")", "{", "e", ".", "haManager", ".", "statusChan", "<-", "status", "\n", "}" ]
// setHAStatus tells the engine what the current HA status is.
[ "setHAStatus", "tells", "the", "engine", "what", "the", "current", "HA", "status", "is", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L169-L171
train
google/seesaw
engine/core.go
haConfig
func (e *Engine) haConfig() (*seesaw.HAConfig, error) { n, err := e.thisNode() if err != nil { return nil, err } // TODO(jsing): This does not allow for IPv6-only operation. return &seesaw.HAConfig{ Enabled: n.State != seesaw.HADisabled, LocalAddr: e.config.Node.IPv4Addr, RemoteAddr: e.config.VRRPDestI...
go
func (e *Engine) haConfig() (*seesaw.HAConfig, error) { n, err := e.thisNode() if err != nil { return nil, err } // TODO(jsing): This does not allow for IPv6-only operation. return &seesaw.HAConfig{ Enabled: n.State != seesaw.HADisabled, LocalAddr: e.config.Node.IPv4Addr, RemoteAddr: e.config.VRRPDestI...
[ "func", "(", "e", "*", "Engine", ")", "haConfig", "(", ")", "(", "*", "seesaw", ".", "HAConfig", ",", "error", ")", "{", "n", ",", "err", ":=", "e", ".", "thisNode", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// haConfig returns the HAConfig for an engine.
[ "haConfig", "returns", "the", "HAConfig", "for", "an", "engine", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L174-L187
train
google/seesaw
engine/core.go
thisNode
func (e *Engine) thisNode() (*seesaw.Node, error) { e.clusterLock.RLock() c := e.cluster e.clusterLock.RUnlock() if c == nil { return nil, fmt.Errorf("cluster configuration not loaded") } // TODO(jsing): This does not allow for IPv6-only operation. ip := e.config.Node.IPv4Addr for _, n := range c.Nodes { i...
go
func (e *Engine) thisNode() (*seesaw.Node, error) { e.clusterLock.RLock() c := e.cluster e.clusterLock.RUnlock() if c == nil { return nil, fmt.Errorf("cluster configuration not loaded") } // TODO(jsing): This does not allow for IPv6-only operation. ip := e.config.Node.IPv4Addr for _, n := range c.Nodes { i...
[ "func", "(", "e", "*", "Engine", ")", "thisNode", "(", ")", "(", "*", "seesaw", ".", "Node", ",", "error", ")", "{", "e", ".", "clusterLock", ".", "RLock", "(", ")", "\n", "c", ":=", "e", ".", "cluster", "\n", "e", ".", "clusterLock", ".", "RUn...
// thisNode returns the Node for the machine on which this engine is running.
[ "thisNode", "returns", "the", "Node", "for", "the", "machine", "on", "which", "this", "engine", "is", "running", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L190-L206
train
google/seesaw
engine/core.go
engineIPC
func (e *Engine) engineIPC() { if err := server.RemoveUnixSocket(e.config.SocketPath); err != nil { log.Fatalf("Failed to remove socket: %v", err) } ln, err := net.Listen("unix", e.config.SocketPath) if err != nil { log.Fatalf("Listen failed: %v", err) } defer os.Remove(e.config.SocketPath) seesawIPC := rpc...
go
func (e *Engine) engineIPC() { if err := server.RemoveUnixSocket(e.config.SocketPath); err != nil { log.Fatalf("Failed to remove socket: %v", err) } ln, err := net.Listen("unix", e.config.SocketPath) if err != nil { log.Fatalf("Listen failed: %v", err) } defer os.Remove(e.config.SocketPath) seesawIPC := rpc...
[ "func", "(", "e", "*", "Engine", ")", "engineIPC", "(", ")", "{", "if", "err", ":=", "server", ".", "RemoveUnixSocket", "(", "e", ".", "config", ".", "SocketPath", ")", ";", "err", "!=", "nil", "{", "log", ".", "Fatalf", "(", "\"", "\"", ",", "er...
// engineIPC starts an RPC server to handle IPC via a Unix Domain socket.
[ "engineIPC", "starts", "an", "RPC", "server", "to", "handle", "IPC", "via", "a", "Unix", "Domain", "socket", "." ]
34716af0775ecb1fad239a726390d63d6b0742dd
https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/engine/core.go#L209-L226
train