proxy/

directory
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0

README

Table of Contents generated with DocToc

gRPC Proxy

This is under experimental.

rk-boot will proxy request if not implemented with configuration in boot.yaml.

Example

Proxy server at 8080

There is no gRPC API defined. Proxy request to localhost:8081 if metadata has K/V as "domain:test".

---
grpc:
  - name: greeter                     # Required
    port: 8080                        # Required
    enabled: true                     # Required
    proxy:
      enabled: true
      rules:
        - type: headerBased
          headerPairs: ["domain:test"]
          dest: ["localhost:8081"]
#        - type: pathBased
#          paths: [""]
#          dest: [""]
#        - type: IpBased
#          Ips: [""]
#          dest: [""]
Test server at 8081

Enable common service in order to receive proxied request from 8080.

---
grpc:
  - name: greeter                     # Required
    port: 8081                        # Required
    enabled: true                     # Required
    commonService:
      enabled: true                   # Optional, default: false
gRPC client call port of 8080

Currently, proxy is only supported with gRPC client with codes.

grpc-gateway or grpcurl is not supported for proxying.

Run
  • Run proxy server
go run proxy/main.go
  • Run test server
go run test/main.go
  • Run client
go run client/main.go

2022-01-15T22:58:31.865+0800    INFO    client/main.go:40       [Message]: message:"Hello !"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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