本文整理汇总了Golang中go/skia/org/infra/go/util.LoggingGzipRequestResponse函数的典型用法代码示例。如果您正苦于以下问题:Golang LoggingGzipRequestResponse函数的具体用法?Golang LoggingGzipRequestResponse怎么用?Golang LoggingGzipRequestResponse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoggingGzipRequestResponse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: runServer
func runServer() {
serverURL := "https://" + *host
if *local {
serverURL = "http://" + *host + *port
}
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc(OAUTH2_CALLBACK_PATH, login.OAuth2CallbackHandler)
r.HandleFunc("/", indexHandler)
r.HandleFunc("/details", detailsPageHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/json/version", skiaversion.JsonHandler)
r.HandleFunc("/json/fuzz-list", fuzzListHandler)
r.HandleFunc("/json/details", detailedReportsHandler)
r.HandleFunc("/status", statusHandler)
r.HandleFunc(`/fuzz/{kind:(binary|api)}/{name:[0-9a-f]+\.(skp)}`, fuzzHandler)
r.HandleFunc(`/metadata/{kind:(binary|api)}/{type:(skp)}/{name:[0-9a-f]+_(debug|release)\.(err|dump)}`, metadataHandler)
r.HandleFunc("/fuzz_count", fuzzCountHandler)
r.HandleFunc("/newBug", newBugHandler)
rootHandler := login.ForceAuth(util.LoggingGzipRequestResponse(r), OAUTH2_CALLBACK_PATH)
http.Handle("/", rootHandler)
glog.Infof("Ready to serve on %s", serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例2: main
func main() {
defer common.LogPanic()
common.InitWithMetrics("push", graphiteServer)
Init()
redirectURL := fmt.Sprintf("http://localhost%s/oauth2callback/", *port)
if !*local {
redirectURL = "https://push.skia.org/oauth2callback/"
}
if err := login.InitFromMetadataOrJSON(redirectURL, login.DEFAULT_SCOPE, login.DEFAULT_DOMAIN_WHITELIST); err != nil {
glog.Fatalf("Failed to initialize the login system: %s", err)
}
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc("/", mainHandler)
r.HandleFunc("/_/change", changeHandler)
r.HandleFunc("/_/state", stateHandler)
r.HandleFunc("/_/status", statusHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Infoln("Ready to serve.")
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例3: main
func main() {
common.InitWithMetrics("push", graphiteServer)
Init()
// By default use a set of credentials setup for localhost access.
var cookieSalt = "notverysecret"
var clientID = "31977622648-1873k0c1e5edaka4adpv1ppvhr5id3qm.apps.googleusercontent.com"
var clientSecret = "cw0IosPu4yjaG2KWmppj2guj"
var redirectURL = fmt.Sprintf("http://localhost%s/oauth2callback/", *port)
if !*local {
cookieSalt = metadata.Must(metadata.ProjectGet(metadata.COOKIESALT))
clientID = metadata.Must(metadata.ProjectGet(metadata.CLIENT_ID))
clientSecret = metadata.Must(metadata.ProjectGet(metadata.CLIENT_SECRET))
redirectURL = "https://push.skia.org/oauth2callback/"
}
login.Init(clientID, clientSecret, redirectURL, cookieSalt, login.DEFAULT_SCOPE, login.DEFAULT_DOMAIN_WHITELIST, *local)
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc("/", mainHandler)
r.HandleFunc("/_/change", changeHandler)
r.HandleFunc("/_/state", stateHandler)
r.HandleFunc("/_/status", statusHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Infoln("Ready to serve.")
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例4: runServer
func runServer(serverURL string) {
r := mux.NewRouter()
r.HandleFunc("/", commitsHandler)
r.HandleFunc("/buildbots", buildbotDashHandler)
r.HandleFunc("/hosts", hostsHandler)
r.HandleFunc("/infra", infraHandler)
r.HandleFunc("/json/builds", buildsJsonHandler)
r.HandleFunc("/json/goldStatus", goldJsonHandler)
r.HandleFunc("/json/perfAlerts", perfJsonHandler)
r.HandleFunc("/json/slaveHosts", slaveHostsJsonHandler)
r.HandleFunc("/json/version", skiaversion.JsonHandler)
r.HandleFunc("/json/{repo}/buildProgress", buildProgressHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
builds := r.PathPrefix("/json/{repo}/builds/{master}/{builder}/{number:[0-9]+}").Subrouter()
builds.HandleFunc("/comments", addBuildCommentHandler).Methods("POST")
builds.HandleFunc("/comments/{commentId:[0-9]+}", deleteBuildCommentHandler).Methods("DELETE")
builders := r.PathPrefix("/json/{repo}/builders/{builder}").Subrouter()
builders.HandleFunc("/comments", addBuilderCommentHandler).Methods("POST")
builders.HandleFunc("/comments/{commentId:[0-9]+}", deleteBuilderCommentHandler).Methods("DELETE")
commits := r.PathPrefix("/json/{repo}/commits").Subrouter()
commits.HandleFunc("/", commitsJsonHandler)
commits.HandleFunc("/{commit:[a-f0-9]+}/comments", addCommitCommentHandler).Methods("POST")
commits.HandleFunc("/{commit:[a-f0-9]+}/comments/{commentId:[0-9]+}", deleteCommitCommentHandler).Methods("DELETE")
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Infof("Ready to serve on %s", serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例5: runServer
func runServer(serverURL string) {
r := mux.NewRouter()
r.HandleFunc("/", mainHandler)
r.HandleFunc("/googlestorage", googleStorageChangeHandler).Methods("POST")
r.HandleFunc("/json/version", skiaversion.JsonHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Infof("Ready to serve on %s", serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例6: runServer
func runServer(serverURL string) {
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc("/", makeBugChomperPage).Methods("GET")
r.HandleFunc("/", submitData).Methods("POST")
r.HandleFunc("/json/version", skiaversion.JsonHandler)
r.HandleFunc(OAUTH_CALLBACK_PATH, login.OAuth2CallbackHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Info("Server is running at " + serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例7: runServer
func runServer(serverURL string) {
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc("/", mainHandler)
r.HandleFunc("/json/mode", modeJsonHandler).Methods("POST")
r.HandleFunc("/json/status", util.CorsHandler(statusJsonHandler))
r.HandleFunc("/json/version", skiaversion.JsonHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Infof("Ready to serve on %s", serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例8: main
func main() {
common.InitWithMetrics("pulld", graphiteServer)
Init()
pullInit()
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc("/", mainHandler).Methods("GET")
r.HandleFunc("/_/list", listHandler).Methods("GET")
r.HandleFunc("/_/change", changeHandler).Methods("POST")
r.HandleFunc("/pullpullpull", pullHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Infoln("Ready to serve.")
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例9: runServer
func runServer(serverURL string) {
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc("/", alertHandler)
r.HandleFunc("/infra", infraAlertHandler)
r.HandleFunc("/rules", rulesHandler)
alerts := r.PathPrefix("/json/alerts").Subrouter()
alerts.HandleFunc("/", util.CorsHandler(alertJsonHandler))
alerts.HandleFunc("/{alertId:[0-9]+}/{action}", postAlertsJsonHandler).Methods("POST")
alerts.HandleFunc("/multi/{action}", postMultiAlertsJsonHandler).Methods("POST")
r.HandleFunc("/json/rules", rulesJsonHandler)
r.HandleFunc("/json/version", skiaversion.JsonHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Infof("Ready to serve on %s", serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例10: RunBackupServer
// RunBackupServer runs an HTTP server which provides downloadable database backups.
func RunBackupServer(db DB, port string) error {
local, ok := db.(*localDB)
if !ok {
return fmt.Errorf("Cannot run a backup server for a non-local database.")
}
r := mux.NewRouter()
r.HandleFunc("/backup", func(w http.ResponseWriter, r *http.Request) {
if err := local.view("Backup", func(tx *bolt.Tx) error {
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("Content-Disposition", "attachment; filename=\"buildbot.db\"")
w.Header().Set("Content-Length", strconv.Itoa(int(tx.Size())))
_, err := tx.WriteTo(w)
return err
}); err != nil {
util.ReportError(w, r, err, fmt.Sprintf("Failed to create DB backup: %s", err))
}
})
http.Handle("/", util.LoggingGzipRequestResponse(r))
return http.ListenAndServe(port, nil)
}
示例11: main
func main() {
defer common.LogPanic()
common.InitWithMetrics("mathserv", graphiteServer)
Init()
// By default use a set of credentials setup for localhost access.
var cookieSalt = "notverysecret"
var clientID = "952643138919-5a692pfevie766aiog15io45kjpsh33v.apps.googleusercontent.com"
var clientSecret = "QQfqRYU1ELkds90ku8xlIGl1"
var redirectURL = fmt.Sprintf("http://localhost%s/oauth2callback/", *port)
if !*local {
cookieSalt = metadata.Must(metadata.ProjectGet(metadata.COOKIESALT))
clientID = metadata.Must(metadata.ProjectGet(metadata.CLIENT_ID))
clientSecret = metadata.Must(metadata.ProjectGet(metadata.CLIENT_SECRET))
redirectURL = "https://mathinate.com/oauth2callback/"
}
login.Init(clientID, clientSecret, redirectURL, cookieSalt, login.DEFAULT_SCOPE, "", *local)
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc("/", mainHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
AttemptLoadCertFromMetadata()
glog.Infoln("Ready to serve.")
if *certChainFile != "" {
glog.Infof("Serving TLS")
go func() {
redir := mux.NewRouter()
redir.HandleFunc("/", redirHandler)
glog.Fatal(http.ListenAndServe(*httpPort, redir))
}()
glog.Fatal(http.ListenAndServeTLS(*port, *certChainFile, *keyFile, nil))
} else {
glog.Infof("Only serving HTTP")
glog.Fatal(http.ListenAndServe(*port, nil))
}
}
示例12: main
func main() {
flag.Parse()
Init()
// Set up login
var cookieSalt = "notverysecret"
var clientID = "31977622648-ubjke2f3staq6ouas64r31h8f8tcbiqp.apps.googleusercontent.com"
var clientSecret = "rK-kRY71CXmcg0v9I9KIgWci"
var useRedirectURL = fmt.Sprintf("http://localhost%s/oauth2callback/", config.Config.FrontEnd.Port)
if !config.Config.Common.Local {
cookieSalt = metadata.Must(metadata.ProjectGet(metadata.COOKIESALT))
clientID = metadata.Must(metadata.ProjectGet(metadata.CLIENT_ID))
clientSecret = metadata.Must(metadata.ProjectGet(metadata.CLIENT_SECRET))
useRedirectURL = config.Config.FrontEnd.RedirectURL
}
login.Init(clientID, clientSecret, useRedirectURL, cookieSalt, login.DEFAULT_SCOPE, login.DEFAULT_DOMAIN_WHITELIST, config.Config.Common.Local)
// Set up the login related resources.
router.HandleFunc(OAUTH2_CALLBACK_PATH, login.OAuth2CallbackHandler)
router.HandleFunc("/loginstatus/", login.StatusHandler)
router.HandleFunc("/logout/", login.LogoutHandler)
router.HandleFunc("/", mainHandler)
router.HandleFunc("/failed", mainHandler)
router.HandleFunc("/passed", mainHandler)
router.PathPrefix("/res/").HandlerFunc(makeResourceHandler())
jsonRouter := router.PathPrefix("/_").Subrouter()
jsonRouter.HandleFunc("/list", fuzzListHandler).Name("fuzzListHandler")
rootHandler := util.LoggingGzipRequestResponse(router)
if config.Config.FrontEnd.ForceLogin {
rootHandler = login.ForceAuth(rootHandler, OAUTH2_CALLBACK_PATH)
}
http.Handle("/", rootHandler)
glog.Fatal(http.ListenAndServe(config.Config.FrontEnd.Port, nil))
}
示例13: runServer
func runServer(serverURL string) {
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(skutil.MakeResourceHandler(*resourcesDir))
chromium_perf.AddHandlers(r)
capture_skps.AddHandlers(r)
lua_scripts.AddHandlers(r)
chromium_builds.AddHandlers(r)
admin_tasks.AddHandlers(r)
pending_tasks.AddHandlers(r)
task_common.AddHandlers(r)
// Common handlers used by different pages.
r.HandleFunc("/json/version", skiaversion.JsonHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
r.HandleFunc("/login/", loginHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
http.Handle("/", skutil.LoggingGzipRequestResponse(r))
glog.Infof("Ready to serve on %s", serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例14: runServer
func runServer() {
serverURL := "https://" + *host
if *local {
serverURL = "http://" + *host + *port
}
r := mux.NewRouter()
r.PathPrefix("/res/").HandlerFunc(util.MakeResourceHandler(*resourcesDir))
r.HandleFunc(OAUTH2_CALLBACK_PATH, login.OAuth2CallbackHandler)
r.HandleFunc("/", indexHandler)
r.HandleFunc("/details", detailHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/json/version", skiaversion.JsonHandler)
r.HandleFunc("/json/fuzz-list", fuzzListHandler)
r.HandleFunc("/json/details", detailsHandler)
rootHandler := login.ForceAuth(util.LoggingGzipRequestResponse(r), OAUTH2_CALLBACK_PATH)
http.Handle("/", rootHandler)
glog.Infof("Ready to serve on %s", serverURL)
glog.Fatal(http.ListenAndServe(*port, nil))
}
示例15: main
func main() {
defer common.LogPanic()
var err error
// Global init to initialize glog and parse arguments.
common.InitWithMetrics("internal", graphiteServer)
if !*local {
*targetList = metadata.Must(metadata.ProjectGet("datahopper_internal_targets"))
}
targets := strings.Split(*targetList, " ")
glog.Infof("Targets: %#v", targets)
codenameDB, err = leveldb.OpenFile(*codenameDbDir, nil)
if err != nil && errors.IsCorrupted(err) {
codenameDB, err = leveldb.RecoverFile(*codenameDbDir, nil)
}
if err != nil {
glog.Fatalf("Failed to open codename leveldb at %s: %s", *codenameDbDir, err)
}
// Initialize the buildbot database.
db, err = buildbot.NewRemoteDB(*buildbotDbHost)
if err != nil {
glog.Fatal(err)
}
var redirectURL = fmt.Sprintf("http://localhost%s/oauth2callback/", *port)
if !*local {
redirectURL = "https://internal.skia.org/oauth2callback/"
}
if err := login.InitFromMetadataOrJSON(redirectURL, login.DEFAULT_SCOPE, login.DEFAULT_DOMAIN_WHITELIST); err != nil {
glog.Fatalf("Failed to initialize login system: %s", err)
}
if *local {
webhook.InitRequestSaltForTesting()
} else {
webhook.MustInitRequestSaltFromMetadata()
}
repos = gitinfo.NewRepoMap(*workdir)
// Ingest Android framework builds.
go func() {
glog.Infof("Starting.")
// In this case we don't want a backoff transport since the Apiary backend
// seems to fail a lot, so we basically want to fall back to polling if a
// call fails.
client, err := auth.NewJWTServiceAccountClient("", "", &http.Transport{Dial: util.DialTimeout}, androidbuildinternal.AndroidbuildInternalScope, storage.CloudPlatformScope)
if err != nil {
glog.Fatalf("Unable to create authenticated client: %s", err)
}
buildService, err := androidbuildinternal.New(client)
if err != nil {
glog.Fatalf("Failed to obtain Android build service: %v", err)
}
glog.Infof("Ready to start loop.")
step(targets, buildService)
for _ = range time.Tick(*period) {
step(targets, buildService)
}
}()
r := mux.NewRouter()
r.HandleFunc("/", indexHandler)
r.HandleFunc("/builders/{codename}/builds/{buildNumber}", redirectHandler)
r.HandleFunc("/builders/{codename}", builderRedirectHandler)
r.HandleFunc("/ingestBuild", ingestBuildHandler)
r.HandleFunc("/loginstatus/", login.StatusHandler)
r.HandleFunc("/logout/", login.LogoutHandler)
r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler)
http.Handle("/", util.LoggingGzipRequestResponse(r))
glog.Fatal(http.ListenAndServe(*port, nil))
}