bifrost

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: AGPL-3.0

README

bifrost

A protobuf router and reverse proxy for services, with input validation capabilities

About

This project is still in alpha: APIs should be considered unstable and likely to change.

Bifrost is a reflective protobuf router and reverse proxy. It uses your protobuf definitions for dynamically generating the gateway and is able to check input based on user-defined rules (see protoc-gen-cel-validate for more details regarding rules).

It features :

  • gRPC, gRPC-web and connect protocols (binding and proxying)
  • protoc-gen-cel-validate validation rules
  • supports Go plugin for loading your custom rules

Installation

For installing bifrost, you can simply run the go install:

$ go install github.com/nlachfr/bifrost/cmd/bifrost

The binary will be placed in your $GOBIN location.

Configuration file

In order to use the gateway, you must provided a configuration file. It will allows you to :

  • define listening address and upstreams
  • specify proto files location
  • configure validation

All the configuration fields are specified in the bifrost.gateway.Configuration message specification.

Example

  1. Create your configuration file
servers:
  - listen:
      - 127.0.0.1:8888
    upstreams:
      '*':
        address: https://demo.connect.build    
        protocol: grpc
files:
  sources:
    - proto/*.proto
  imports:
    - "."
validate:
  rule:
    servicerules:
      buf.connect.demo.eliza.v1.ElizaService:
        rule:
          programs:
            - expr: 'attribute_context.request.headers["ok"] == "ok"'      
      connect.ping.v1.PingService:
        rule:
          programs:
            - expr: 'attribute_context.request.headers["ok"] == "ok"'
  1. Call bifrost with your newly created configuration
$ bifrost -config ./config.yml

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL