func init() { ok := tfe.AddRules("test", func() map[string]tfe.Rules { return map[string]tfe.Rules{ ":8888": tfe.Rules{ &tfe.PrefixRewriteRule{ Name: "tco", SourcePathPrefix: "/tco/", ProxiedPathPrefix: "/", Service: tfe.CreateStaticHttpCluster( tfe.StaticHttpCluster{ Name: "tco", Hosts: []string{ "t.co", }, Timeout: 1 * time.Second, Retries: 1, ProberReq: rpcx.ProberReqLastFail, }), Reporter: tfe.NewHttpStatsReporter(gostrich.AdminServer().GetStats().Scoped("tfe-tco")), }, &tfe.PrefixRewriteRule{ Name: "tweetbutton", SourcePathPrefix: "/urls-real/", ProxiedPathPrefix: "/1/urls/", ProxiedAttachHeaders: map[string][]string{ "True-Client-Ip": []string{"127.0.0.1"}, }, Service: tfe.CreateStaticHttpCluster( tfe.StaticHttpCluster{ Name: "tbapi", Hosts: []string{ "urls-real.api.twitter.com", }, Timeout: 1 * time.Second, Retries: 1, ProberReq: rpcx.ProberReqLastFail, }), Reporter: tfe.NewHttpStatsReporter(gostrich.AdminServer().GetStats().Scoped("tfe-tbapi")), }, &tfe.PrefixRewriteRule{ Name: "dead", SourcePathPrefix: "/dead/", ProxiedPathPrefix: "/dead/", }, }, } }) if !ok { log.Println("Rule set named test already exists") } }
func init() { ok := tfe.AddRules("tweetbutton-smf1", func() map[string]tfe.Rules { return map[string]tfe.Rules{ ":8888": tfe.Rules{ &tfe.PrefixRewriteRule{ Name: "tweetbutton-smf1-plaintext", SourcePathPrefix: "/1/urls/", ProxiedPathPrefix: "/1/urls/", ProxiedAttachHeaders: map[string][]string{ "True-Client-Ip": []string{"127.0.0.1"}, }, Service: tfe.CreateStaticHttpCluster( tfe.StaticHttpCluster{ Name: "tweetbutton", Hosts: []string{ /*"smf1-aea-35-sr2:8000",*/ /*"smf1-adz-03-sr3:8000",*/ "smf1-adj-27-sr4:8000", "smf1-afo-35-sr4:8000", "smf1-adz-19-sr2:8000", "smf1-adb-23-sr3:8000", "smf1-adz-27-sr1:8000", "smf1-afe-15-sr3:8000", "smf1-aer-19-sr4:8000", }, Timeout: 2 * time.Second, Retries: 1, ProberReq: rpcx.ProberReqLastFail, CacheResponseBody: true, MaxIdleConnsPerHost: 20, }), Reporter: tfe.NewHttpStatsReporter(gostrich.AdminServer().GetStats().Scoped("tfe-tbapi-smf1-plaintext")), }, }, } }) if !ok { log.Println("Rule set named tweetbutton-smf1 already exists") } }
func init() { ok := tfe.AddRules("tweetbutton-tunnels", func() map[string]tfe.Rules { return map[string]tfe.Rules{ ":8888": tfe.Rules{ &tfe.PrefixRewriteRule{ Name: "tweetbutton-tunnels", SourcePathPrefix: "/1/urls/", ProxiedPathPrefix: "/1/urls/", ProxiedAttachHeaders: map[string][]string{ "True-Client-Ip": []string{"127.0.0.1"}, }, Service: tfe.CreateStaticHttpCluster( tfe.StaticHttpCluster{ Name: "tweetbutton-tunnels", Hosts: []string{ "localhost:8000", // self "localhost:8001", "localhost:8002", "localhost:8003", "localhost:8004", "localhost:8005", "localhost:8006", "localhost:8007", "localhost:8008", }, Timeout: 2 * time.Second, Retries: 1, ProberReq: rpcx.ProberReqLastFail, }), Reporter: tfe.NewHttpStatsReporter(gostrich.AdminServer().GetStats().Scoped("tweetbutton-tunneled")), }, }, } }) if !ok { log.Println("Rule set named tweetbutton-tunnels already exists") } }
func init() { ok := tfe.AddRules("empty", func() map[string]tfe.Rules { return make(map[string]tfe.Rules) }) if !ok { log.Println("Rule set named empty already exists") } }