Loading Gopkg.lock +18 −1 Original line number Diff line number Diff line Loading @@ -99,6 +99,22 @@ ] revision = "7d7bc8747e3f614c5c587729a341fe7d8903cdb8" [[projects]] name = "go.opencensus.io" packages = [ "internal/tagencoding", "plugin/grpc", "plugin/grpc/grpcstats", "plugin/grpc/grpctrace", "stats", "tag", "trace", "trace/propagation", "zpages" ] revision = "7e6c5d736280267bc85cfd63b23507c4889ef82e" version = "v0.2.0" [[projects]] name = "go.uber.org/atomic" packages = ["."] Loading Loading @@ -188,6 +204,7 @@ "connectivity", "credentials", "encoding", "encoding/gzip", "grpclb/grpc_lb_v1/messages", "grpclog", "internal", Loading Loading @@ -215,6 +232,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 inputs-digest = "bd27c78031b478645517c097fe42bdb946de0a2a3fdbecf6c56718b8e2ba9492" inputs-digest = "3dca4cdde39b8789a533da94987c9dac078157b93a881077b085310068091603" solver-name = "gps-cdcl" solver-version = 1 Gopkg.toml +4 −0 Original line number Diff line number Diff line Loading @@ -48,3 +48,7 @@ [[constraint]] name = "golang.org/x/crypto" [[constraint]] name = "go.opencensus.io" version = "0.2.0" server/api.go +31 −24 Original line number Diff line number Diff line Loading @@ -15,29 +15,32 @@ package server import ( "crypto" "database/sql" "github.com/golang/protobuf/ptypes/empty" "go.uber.org/zap" "golang.org/x/net/context" "encoding/base64" "fmt" "google.golang.org/grpc" "github.com/heroiclabs/nakama/api" "github.com/grpc-ecosystem/grpc-gateway/runtime" "math/rand" "net" "net/http" "strings" "time" "github.com/dgrijalva/jwt-go" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/ptypes/empty" "github.com/gorilla/handlers" "github.com/gorilla/mux" "net" "google.golang.org/grpc/status" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/heroiclabs/nakama/api" "github.com/satori/go.uuid" ocgrpc "go.opencensus.io/plugin/grpc" "go.uber.org/zap" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" _ "google.golang.org/grpc/encoding/gzip" // this enabled gzip compression on server for grpc "google.golang.org/grpc/metadata" "strings" "encoding/base64" "github.com/dgrijalva/jwt-go" "crypto" "math/rand" "time" "github.com/satori/go.uuid" "github.com/golang/protobuf/jsonpb" "google.golang.org/grpc/status" ) // Keys used for storing/retrieving user information in the context of a request after authentication. Loading @@ -57,6 +60,7 @@ type ApiServer struct { func StartApiServer(logger *zap.Logger, db *sql.DB, config Config, registry *SessionRegistry, tracker Tracker, pipeline *pipeline, runtimePool *RuntimePool, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler) *ApiServer { grpcServer := grpc.NewServer( grpc.StatsHandler(ocgrpc.NewServerStatsHandler()), grpc.UnaryInterceptor(SecurityInterceptorFunc(logger, config)), ) Loading Loading @@ -97,10 +101,13 @@ func StartApiServer(logger *zap.Logger, db *sql.DB, config Config, registry *Ses grpcGatewayRouter := mux.NewRouter() grpcGatewayRouter.HandleFunc("/ws", NewSocketWsAcceptor(logger, config, registry, tracker, jsonpbMarshaler, jsonpbUnmarshaler, pipeline.processRequest)) // TODO restore when admin endpoints are available. // grpcGatewayRouter.HandleFunc("/metrics", zpages.RpczHandler) // grpcGatewayRouter.HandleFunc("/trace", zpages.TracezHandler) grpcGatewayRouter.NewRoute().Handler(grpcGateway) handlerWithCORS := handlers.CORS(CORSHeaders, CORSOrigins)(grpcGatewayRouter) handlerWithGzip := handlers.CompressHandler(grpcGatewayRouter) handlerWithCORS := handlers.CORS(CORSHeaders, CORSOrigins)(handlerWithGzip) s.grpcGatewayServer = &http.Server{ Addr: fmt.Sprintf(":%d", config.GetSocket().Port+1), Handler: handlerWithCORS, Loading vendor/go.opencensus.io/.gitignore 0 → 100644 +2 −0 Original line number Diff line number Diff line /.idea/ vendor/go.opencensus.io/.travis.yml 0 → 100644 +22 −0 Original line number Diff line number Diff line language: go go: # 1.8 is tested by AppVeyor - 1.9.x - master go_import_path: go.opencensus.io # Don't email me the results of the test runs. notifications: email: false before_script: - GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) # All the .go files, excluding vendor/ if any - PKGS=$(go list ./... | grep -v /vendor/) # All the import paths, excluding vendor/ if any script: - gofmt -w ./ - go vet ./... - go test -v -race $PKGS # Run all the tests with the race detector enabled - 'if [[ $TRAVIS_GO_VERSION = 1.8* ]]; then ! golint ./... | grep -vE "(_mock|_string|\.pb)\.go:"; fi' Loading
Gopkg.lock +18 −1 Original line number Diff line number Diff line Loading @@ -99,6 +99,22 @@ ] revision = "7d7bc8747e3f614c5c587729a341fe7d8903cdb8" [[projects]] name = "go.opencensus.io" packages = [ "internal/tagencoding", "plugin/grpc", "plugin/grpc/grpcstats", "plugin/grpc/grpctrace", "stats", "tag", "trace", "trace/propagation", "zpages" ] revision = "7e6c5d736280267bc85cfd63b23507c4889ef82e" version = "v0.2.0" [[projects]] name = "go.uber.org/atomic" packages = ["."] Loading Loading @@ -188,6 +204,7 @@ "connectivity", "credentials", "encoding", "encoding/gzip", "grpclb/grpc_lb_v1/messages", "grpclog", "internal", Loading Loading @@ -215,6 +232,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 inputs-digest = "bd27c78031b478645517c097fe42bdb946de0a2a3fdbecf6c56718b8e2ba9492" inputs-digest = "3dca4cdde39b8789a533da94987c9dac078157b93a881077b085310068091603" solver-name = "gps-cdcl" solver-version = 1
Gopkg.toml +4 −0 Original line number Diff line number Diff line Loading @@ -48,3 +48,7 @@ [[constraint]] name = "golang.org/x/crypto" [[constraint]] name = "go.opencensus.io" version = "0.2.0"
server/api.go +31 −24 Original line number Diff line number Diff line Loading @@ -15,29 +15,32 @@ package server import ( "crypto" "database/sql" "github.com/golang/protobuf/ptypes/empty" "go.uber.org/zap" "golang.org/x/net/context" "encoding/base64" "fmt" "google.golang.org/grpc" "github.com/heroiclabs/nakama/api" "github.com/grpc-ecosystem/grpc-gateway/runtime" "math/rand" "net" "net/http" "strings" "time" "github.com/dgrijalva/jwt-go" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/ptypes/empty" "github.com/gorilla/handlers" "github.com/gorilla/mux" "net" "google.golang.org/grpc/status" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/heroiclabs/nakama/api" "github.com/satori/go.uuid" ocgrpc "go.opencensus.io/plugin/grpc" "go.uber.org/zap" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" _ "google.golang.org/grpc/encoding/gzip" // this enabled gzip compression on server for grpc "google.golang.org/grpc/metadata" "strings" "encoding/base64" "github.com/dgrijalva/jwt-go" "crypto" "math/rand" "time" "github.com/satori/go.uuid" "github.com/golang/protobuf/jsonpb" "google.golang.org/grpc/status" ) // Keys used for storing/retrieving user information in the context of a request after authentication. Loading @@ -57,6 +60,7 @@ type ApiServer struct { func StartApiServer(logger *zap.Logger, db *sql.DB, config Config, registry *SessionRegistry, tracker Tracker, pipeline *pipeline, runtimePool *RuntimePool, jsonpbMarshaler *jsonpb.Marshaler, jsonpbUnmarshaler *jsonpb.Unmarshaler) *ApiServer { grpcServer := grpc.NewServer( grpc.StatsHandler(ocgrpc.NewServerStatsHandler()), grpc.UnaryInterceptor(SecurityInterceptorFunc(logger, config)), ) Loading Loading @@ -97,10 +101,13 @@ func StartApiServer(logger *zap.Logger, db *sql.DB, config Config, registry *Ses grpcGatewayRouter := mux.NewRouter() grpcGatewayRouter.HandleFunc("/ws", NewSocketWsAcceptor(logger, config, registry, tracker, jsonpbMarshaler, jsonpbUnmarshaler, pipeline.processRequest)) // TODO restore when admin endpoints are available. // grpcGatewayRouter.HandleFunc("/metrics", zpages.RpczHandler) // grpcGatewayRouter.HandleFunc("/trace", zpages.TracezHandler) grpcGatewayRouter.NewRoute().Handler(grpcGateway) handlerWithCORS := handlers.CORS(CORSHeaders, CORSOrigins)(grpcGatewayRouter) handlerWithGzip := handlers.CompressHandler(grpcGatewayRouter) handlerWithCORS := handlers.CORS(CORSHeaders, CORSOrigins)(handlerWithGzip) s.grpcGatewayServer = &http.Server{ Addr: fmt.Sprintf(":%d", config.GetSocket().Port+1), Handler: handlerWithCORS, Loading
vendor/go.opencensus.io/.gitignore 0 → 100644 +2 −0 Original line number Diff line number Diff line /.idea/
vendor/go.opencensus.io/.travis.yml 0 → 100644 +22 −0 Original line number Diff line number Diff line language: go go: # 1.8 is tested by AppVeyor - 1.9.x - master go_import_path: go.opencensus.io # Don't email me the results of the test runs. notifications: email: false before_script: - GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) # All the .go files, excluding vendor/ if any - PKGS=$(go list ./... | grep -v /vendor/) # All the import paths, excluding vendor/ if any script: - gofmt -w ./ - go vet ./... - go test -v -race $PKGS # Run all the tests with the race detector enabled - 'if [[ $TRAVIS_GO_VERSION = 1.8* ]]; then ! golint ./... | grep -vE "(_mock|_string|\.pb)\.go:"; fi'