Kevin Wan 2a6f801978 chore: refactoring mapping name (#2168) 2 anni fa
..
internal 8d567b5508 feat: support customized header to metadata processor (#2162) 2 anni fa
config.go 2a6f801978 chore: refactoring mapping name (#2168) 2 anni fa
readme.md 557383fbbf feat: verify RpcPath on startup (#2159) 2 anni fa
server.go 2a6f801978 chore: refactoring mapping name (#2168) 2 anni fa

readme.md

Gateway

Usage

  • main.go

    var configFile = flag.String("f", "config.yaml", "config file")
    
    func main() {
    	flag.Parse()
    
    	var c gateway.GatewayConf
    	conf.MustLoad(*configFile, &c)
    	gw := gateway.MustNewServer(c)
    	defer gw.Stop()
    	gw.Start()
    }
    
  • config.yaml

    Name: demo-gateway
    Host: localhost
    Port: 8888
    Upstreams:
    - Grpc:
      Etcd:
        Hosts:
        - localhost:2379
        Key: hello.rpc
    # protoset mode
    ProtoSet: hello.pb
    Mapping:
      - Method: get
        Path: /pingHello/:ping
        RpcPath: hello.Hello/Ping
    - Grpc:
      Endpoints:
        - localhost:8081
    # reflection mode, no ProtoSet settings
    Mapping:
      - Method: post
        Path: /pingWorld
        RpcPath: world.World/Ping
    

Generate ProtoSet files

  • example command

    protoc --descriptor_set_out=hello.pb hello.proto