Git Product home page Git Product logo

go-gateway's Introduction

tRPC-Gateway

LICENSE

Table of Contents

Introduction

tRPC-Gateway is a business gateway framework in the tRPC ecosystem.

It has the following advantages:

  1. Low integration cost: It is essentially a tRPC-Go service, so it can be deployed like any other tRPC-Go service.
  2. Low entry barrier: It can fully reuse the tRPC ecosystem, including service governance, monitoring and alerting, protocol support, and log querying.
  3. Rich routing strategies: It supports various routing strategies such as exact matching, prefix matching, regular expression matching, fine-grained matching, and gray deployment.
  4. Strong scalability: The development threshold for gateway plugins is lowered to the level of developing a tRPC filter, allowing for quick expansion of business-specific gateway logic.
  5. Easy enrichment of plugin ecosystem: The development threshold for gateway plugins is low enough to easily enrich the plugin ecosystem.

Background

In the context of cloud-native technology, business gateways have become indispensable. With the gradual adoption of the internal tRPC framework within the company, there are two solutions to meet the demands for business gateways:

1 Modifying an external open-source gateway: This solution allows for the reuse of core functions from an open-source gateway but requires significant adaptation work to fit into the tRPC ecosystem.

2 Building a business gateway within the tRPC ecosystem based on the tRPC framework: It was found that this only requires the development of gateway routing logic.

tRPC-Gateway is a business gateway developed based on solution 2.

Gateway Deployment:

Running Local Demo

See example/README.md

Deployment on with etcd

  1. Create a new service repository and add the main.go file, refer to main.go main.go
  2. Apply for Rainbow configuration and add the router.yaml configuration file, refer to router.yaml
  3. Deploy the service with framework configuration, refer to trpc_go.yaml

Routing Configuration

Modify the router.yaml file to configure the forwarding of your own interfaces. For more details, see Routing Configuration

Gateway Plugin Development

You can extend the functionality of the gateway through plugins. See Gateway Plugin Development for more details.

List of Common Plugins

Forwarding Protocol Support

tRPC-Gateway supports HTTP as the entry protocol and can forward to other protocols. Custom protocols can be implemented by implementing the CliProtocolHandler interface.

Supported forwarding protocols:

  • http -> http
  • http -> trpc
  • http -> grpc

Does it support trpc -> trpc protocol forwarding?

No, it doesn't support trpc -> trpc protocol forwarding because it would require writing separate plugin logic to support both HTTP and trpc protocols, which would increase complexity.

If the caller expects to use the trpc pb client for calling, you can use the http -> trpc forwarding method. There is no difference in the caller's code, except that the caller's protocol can only use http.

How to Contribute

You can fork the project, make modifications, and initiate a merge request (MR). For more details, please consult [email protected]

go-gateway's People

Contributors

quons avatar i-can-do-fourier avatar

Stargazers

 avatar sirius_xyl avatar  avatar Chocolate avatar  avatar jincurry avatar 宁鹏涛 avatar ChenMingjie avatar Leo avatar

Watchers

Lucian avatar ChenMingjie avatar liucf avatar CoderLiu avatar lioncf avatar  avatar wonderfou avatar

go-gateway's Issues

address already in use

* get_listener_err||fasthttp reuseport listen err||type:business, code:999, msg:address already in use, caused by address already in use

i try make run and got this, i use another port and the problem remain

gateway in kubernetes

how this gateway work with kubernetes's ingress controller, any sample?
or it just work outside the kubernetes cluster as an entrypoint to the server

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.