Documentation ¶
Overview ¶
Example (CreateEgressOperators) ¶
var start time.Time err := createEgressOperators() fmt.Printf("test: createEgressOperators() -> [err:%v]\n", err) //req,_ := http.NewRequest("") logd := accessdata.NewEgressEntry(start, 0, nil, nil, nil, "") accesslog.Log[accesslog.TestOutputHandler](logd)
Output: test: createEgressOperators() -> [err:<nil>] test: Write() -> [{"traffic":"egress","start_time":"0001-01-01 00:00:00.000000","duration_ms":0,"southwest":"region","custom":"egress-static-data"}]
Example (CreateIngressOperators) ¶
var start time.Time err := createIngressOperators() fmt.Printf("test: createIngressOperators() -> [err:%v]\n", err) //req,_ := http.NewRequest("") logd := accessdata.NewIngressEntry(start, 0, nil, nil, 0, 0, "") accesslog.Log[accesslog.TestOutputHandler](logd)
Output: test: createIngressOperators() -> [err:<nil>] test: Write() -> [{"custom":"ingress-static-data","start_time":"0001-01-01 00:00:00.000000","duration_ms":0,"traffic":"ingress","northwest":"region"}]
Example (InitEgress) ¶
errs := initEgress() fmt.Printf("test: initEgress() -> [err:%v]\n", errs) name := "google-search" act := actuator.EgressTable.LookupByName(name) fmt.Printf("test: LookupByName(%v) -> [actuator:%v]\n", name, act.Name()) name = "google-home" act = actuator.EgressTable.LookupByName(name) fmt.Printf("test: LookupByName(%v) -> [actuator:%v]\n", name, act.Name()) req, _ := http.NewRequest("", "https://www.google.com/search?q=test", nil) act = actuator.EgressTable.Lookup(req) fmt.Printf("test: Lookup(https://www.google.com/search?q=test) -> [actuator:%v]\n", act.Name()) req, _ = http.NewRequest("", "https://www.twitter.com", nil) act = actuator.EgressTable.Lookup(req) fmt.Printf("test: Lookup(https://www.twitter.com) -> [actuator:%v]\n", act.Name()) req, _ = http.NewRequest("", "https://instagram.com", nil) act = actuator.EgressTable.Lookup(req) fmt.Printf("test: Lookup(https://instagram.com) -> [actuator:%v]\n", act.Name())
Output: test: initEgress() -> [err:[]] test: LookupByName(google-search) -> [actuator:google-search] test: LookupByName(google-home) -> [actuator:google-home] test: Lookup(https://www.google.com/search?q=test) -> [actuator:google-search] test: Lookup(https://www.twitter.com) -> [actuator:twitter-home] test: Lookup(https://instagram.com) -> [actuator:*]
Example (InitIngress) ¶
//name := "fs/host/default_routes_dev.json" errs := initIngress() fmt.Printf("test: initIngress() -> [err:%v]\n", errs) act := actuator.IngressTable.Host() c, _ := act.RateLimiter() fmt.Printf("test: Ingress.Host() -> [actuator:%v] [rateLimiter:%v]\n", act.Name(), c != nil) req, _ := http.NewRequest("", "https://www.google.com", nil) act = actuator.IngressTable.Lookup(req) c1, _ := act.Timeout() fmt.Printf("test: Ingress.Lookup(https://www.google.com) -> [actuator:%v] [timeout:%v]\n", act.Name(), c1 != nil) req, _ = http.NewRequest("", "https://www.google.com/google/search", nil) act = actuator.IngressTable.Lookup(req) c1, _ = act.Timeout() fmt.Printf("test: Ingress.Lookup(https://www.google.com/google/search) -> [actuator:%v] [timeout:%v]\n", act.Name(), c1 != nil) act = actuator.EgressTable.Lookup(req) c1, _ = act.Timeout() fmt.Printf("test: Egress.Lookup(req) -> [actuator:%v] [timeout:%v]\n", act.Name(), c1 != nil)
Output: test: initIngress() -> [err:[]] test: Ingress.Host() -> [actuator:host] [rateLimiter:true] test: Ingress.Lookup(https://www.google.com) -> [actuator:default-ingress] [timeout:true] test: Ingress.Lookup(https://www.google.com/google/search) -> [actuator:google-search] [timeout:true] test: Egress.Lookup(req) -> [actuator:default-egress] [timeout:true]
Example (ReadRoutes) ¶
name := "fs/host/default_routes_dev.json" routes, err := readRoutes(name) fmt.Printf("test: readRoutes(%v) -> [err:%v] [routes:%v]\n", name, err, len(routes))
Output: test: readRoutes(fs/host/default_routes_dev.json) -> [err:<nil>] [routes:3]
Example (StartupResources) ¶
status := startupResources[template.DebugErrorHandler, template.StdOutputHandler]() fmt.Printf("test: startupResources() -> %v\n", status)
Output: test: startupResources() -> 0 Successful
Index ¶
Examples ¶
Constants ¶
View Source
const ( GooglePattern = "/google" TwitterPattern = "/twitter" HealthLivenessPattern = "/health/liveness" FacebookPattern = "/facebook" GoogleRouteName = "google-search" IndexPattern = "/debug/pprof/" CmdLinePattern = "/debug/pprof/cmdline" ProfilePattern = "/debug/pprof/profile" // ?seconds=30 SymbolPattern = "/debug/pprof/symbol" TracePattern = "/debug/pprof/trace" IndexRouteName = "pprof-index" CmdLineRouteName = "pprof-cmdline" ProfileRouteName = "pprof-profile" SymbolRouteName = "pprof-symbol" TraceRouteName = "pprof-trace" )
View Source
const ( RouteName = "host" DefaultIngressRouteName = "default-ingress" DefaultEgressRouteName = "default-egress" )
Variables ¶
This section is empty.
Functions ¶
func HealthLivenessHandler ¶
func HealthLivenessHandler(w http.ResponseWriter, r *http.Request)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.