This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package sharding | |
| import ( | |
| "sync" | |
| "github.com/golang/groupcache/consistenthash" | |
| "gopkg.in/redis.v1" | |
| ) | |
| const replicas = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func copyHeader(dst, src http.Header) { | |
| for k, vv := range src { | |
| for _, v := range vv { | |
| dst.Add(k, v) | |
| } | |
| } | |
| } | |
| func cloneReq(req *http.Request) *http.Request { | |
| outreq := new(http.Request) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "net/http" | |
| ) | |
| func init() { | |
| http.Handle("/", proxyHandler) | |
| } | |
| func proxyHandler(w http.ResponseWriter, r *http.Request) { | |
| w.Header().Set("Access-Control-Allow-Origin", "*") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (.*):(\d*):in '(.*)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package httptest | |
| import ( | |
| "bytes" | |
| "io" | |
| "net/http" | |
| "appengine" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package gaetesting | |
| import ( | |
| "net/http" | |
| "time" | |
| "myapp/context" | |
| "myapp/testlib" | |
| "launchpad.net/gocheck" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bytes" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net" | |
| "os" | |
| "runtime" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bytes" | |
| "flag" | |
| "fmt" | |
| "net" | |
| "sync/atomic" | |
| "time" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| processor : 0 | |
| vendor_id : GenuineIntel | |
| cpu family : 6 | |
| model : 2 | |
| model name : QEMU Virtual CPU version 0.14.1 | |
| stepping : 3 | |
| cpu MHz : 2400.012 | |
| cache size : 4096 KB | |
| fpu : yes | |
| fpu_exception : yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "net" | |
| "runtime" | |
| ) | |
| func proxy(conn net.Conn) { | |
| buf := make([]byte, 1000) |