Skip to content
/ hypro Public

A simple HTTP local tunnel powered by Go and gRPC

License

Notifications You must be signed in to change notification settings

chuangbo/hypro

Repository files navigation

🧚 hypro

GoDoc Go Report Card

HYpertext-transfer-protocol PROxy

Hypro is a simple HTTP tunnel powered by go and gRPC.

 HTTP Server
     |
Reverse Proxy (Server)
     |
 gRPC Stream
     |
Reverse Proxy (Client)
     |
   Target

Install

# Server
go install github.com/chuangbo/hypro/cmd/hypro-server
# Client
go install github.com/chuangbo/hypro/cmd/hypro

Usage

  1. DNS

    Add a DNS A record to your server:

    example.com => YOUR_SERVER_IP

    And then add a wildcard DNS A record to your server:

    *.example.com => YOUR_SERVER_IP

  2. Server

    hypro-server
    
  3. Client

    hypro -server example.com -insecure -domain myapp.example.com -target http://localhost:8080
    

Secure Connection

  1. Create self-sign certificate

    # Generate CA key:
    openssl ecparam -name prime256v1 -noout -genkey -out ca.key
    
    # Generate CA certificate:
    openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "/C=NZ/ST=AKL/L=Auckland/O=HyproCompany/OU=HyproApp/CN=HyproRootCA"
    
    # Generate server key:
    openssl ecparam -name prime256v1 -noout -genkey -out server.key
    
    # Generate server signing request:
    openssl req -new -key server.key -out server.csr -subj "/C=NZ/ST=AKL/L=Auckland/O=HyproCompany/OU=HyproApp/CN=$(SERVER_NAME)"
    
    # Self-sign server certificate:
    openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
  2. Server

    hypro-server -cert server.crt -key server.key
  3. Client

    hypro -server example.com -cert server.crt -domain myapp.example.com -target http://localhost:8080

Documentation

https://godoc.org/github.com/chuangbo/hypro

Build from source

go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
make

License

MIT

Copyright (c) 2018-present, Chuangbo Li

Todos

  • Tests
  • Benchmarks
  • Reuse connections
  • Reconnect to the server
  • 12-factor
  • Graceful reload
  • Max connections
  • Record / Redo requests
  • Cluster

About

A simple HTTP local tunnel powered by Go and gRPC

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published