GithubHelp home page GithubHelp logo

isabella232 / grpc-proxy-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from improbable-io/grpc-proxy

0.0 0.0 0.0 22 KB

gRPC proxy is a Go reverse proxy that allows for rich routing of gRPC calls with minimum overhead.

License: Apache License 2.0

Go 97.19% Makefile 0.73% Protocol Buffer 2.08%

grpc-proxy-1's Introduction

gRPC Proxy

This is an implementation of a gRPC Proxying Server in Golang, based on grpc-go. Features:

  • full support for all Streams: Unitary RPCs and Streams: One-Many, Many-One, Many-Many
  • pass-through mode: no overhead of encoding/decoding messages
  • customizable StreamDirector routing based on context.Context of the Stream, allowing users to return a grpc.ClientConn after dialing the backend of choice based on:
    • inspection of service and method name
    • inspection of user credentials in authorization header
    • inspection of custom user-features
    • inspection of TLS client cert credentials
  • integration tests

Example Use

director := func(ctx context.Context) (*grpc.ClientConn, error) {
    if err := CheckBearerToken(ctx); err != nil {
        return nil, grpc.Errorf(codes.PermissionDenied, "unauthorized access: %v", err)
    }
    stream, _ := transport.StreamFromContext(ctx)
    backend, found := PreDialledBackends[stream.Method()];
    if !found {
        return nil, grpc.Errorf(codes.Unimplemented, "the service %v is not implemented", stream.Method)
    }
    return backend, nil
}

proxy := grpcproxy.NewProxy(director)
proxy.Server(boundListener)

Status

This is alpha software, written as a proof of concept. It has been integration-tested, but please expect bugs.

The current implementation depends on a public interface to ClientConn.Picker(), which hopefully will be upstreamed in grpc-go#397.

Contributors

Names in no particular order:

License

grpc-proxy is released under the Apache 2.0 license. See LICENSE.txt.

Part of the main server loop are lifted from the grpc-go Server, which is copyrighted Google Inc. and licensed under MIT license.

grpc-proxy-1's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.