All Projects → cwdtom → gateway

cwdtom / gateway

Licence: MIT license
API proxy gateway base on netty and okHttp.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to gateway

Armeria
Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
Stars: ✭ 3,392 (+16052.38%)
Mutual labels:  netty, gateway
piccolo
Netty4长连接网关
Stars: ✭ 19 (-9.52%)
Mutual labels:  netty, gateway
Spring Boot Demo
spring boot demo 是一个Spring Boot、Spring Cloud的项目示例,根据市场主流的后端技术,共集成了30+个demo,未来将持续更新。该项目包含helloworld(快速入门)、web(ssh项目快速搭建)、aop(切面编程)、data-redis(redis缓存)、quartz(集群任务实现)、shiro(权限管理)、oauth2(四种认证模式)、shign(接口参数防篡改重放)、encoder(用户密码设计)、actuator(服务监控)、cloud-config(配置中心)、cloud-gateway(服务网关)等模块
Stars: ✭ 323 (+1438.1%)
Mutual labels:  netty, gateway
ship-gate
Use SpringWebFlux,Netty and Nacos to build high performance,responsive API gateways.
Stars: ✭ 138 (+557.14%)
Mutual labels:  netty, gateway
Protools
历经开发周期两年,并且应用过千万级别项目的工具箱
Stars: ✭ 663 (+3057.14%)
Mutual labels:  netty, okhttp
lemon
The micro service gateway framework. Dubbo, HTTP etc.
Stars: ✭ 17 (-19.05%)
Mutual labels:  gateway
graphql-portal-dashboard
Dashboard to manage GraphQL API Gateway
Stars: ✭ 35 (+66.67%)
Mutual labels:  gateway
guli-mall
尚硅谷-谷粒商城代码及文档https://www.yuque.com/zhangshuaiyin/guli-mall
Stars: ✭ 233 (+1009.52%)
Mutual labels:  gateway
sx1302 hal
SX1302/SX1303 Hardware Abstraction Layer and Tools (packet forwarder...)
Stars: ✭ 121 (+476.19%)
Mutual labels:  gateway
PSAVanCanBridge
VAN - CAN protocol bridge (V2C) for cars made by PSA Group (Peugeot, Citroen)
Stars: ✭ 67 (+219.05%)
Mutual labels:  gateway
OkSimple
OkSimple :powerful and simple okhttp network library
Stars: ✭ 57 (+171.43%)
Mutual labels:  okhttp
fastim
🚀基于Netty高可用分布式即时通讯系统,支持长连接网关管理、单聊、群聊、离线消息、消息推送消息、消息已读未读、消息未读数、红包、消息漫游等功能,支持集群部署的分布式架构。
Stars: ✭ 111 (+428.57%)
Mutual labels:  netty
gluu-gateway
Gluu API 🚀 and Web Gateway 🎯
Stars: ✭ 29 (+38.1%)
Mutual labels:  gateway
qynat-spring-boot-starter
A springboot-starter that can achieve Intranet penetration. 一款可以实现内网穿透的springboot-starter。
Stars: ✭ 65 (+209.52%)
Mutual labels:  netty
GitMessengerBot-Android
타입스크립트, V8 엔진의 자바스크립트, 파이썬 그리고 Git을 지원하는 최첨단 메신저 봇!
Stars: ✭ 51 (+142.86%)
Mutual labels:  okhttp
zrp
zrp 是使用Java开发的一款基于Netty的内网穿透工具,主要用于将内网服务反向代理到公网访问。目前支持所有TCP上层协议的代理,包括但不限于HTTP、SSH、FTP、TELNET、SMTP、POP3、DNS等。
Stars: ✭ 32 (+52.38%)
Mutual labels:  netty
javayh-platform
javayh-platform 使用Springboot2.2.6为开发脚手架,SpringCloud为云端服务框架,Nacos为注册中心、分布式配置管理中心,Oauth2协议实现统一授权,Mybatis作为持久层框架,提供了代码生成器,SQL防注入,SwaggerAPI文档,Redis 作为缓存服务等强大的功能
Stars: ✭ 32 (+52.38%)
Mutual labels:  gateway
netty-mqtt-client
No description or website provided.
Stars: ✭ 31 (+47.62%)
Mutual labels:  netty
OKHttpLogInterceptor
A Pretty OkHttp Logging Interceptor(一款简洁漂亮的OkHttp Logging拦截器)
Stars: ✭ 16 (-23.81%)
Mutual labels:  okhttp
Kriptofolio
Free open source minimalistic cryptocurrencies portfolio app for Android.
Stars: ✭ 79 (+276.19%)
Mutual labels:  okhttp

Gateway

Version Build Status License

Overview

  • API proxy gateway base on netty and okHttp.
  1. Support http protocol.
  2. Support https protocol.
  3. Support cors protocol.
  4. Support local flow limits base on token bucket.
  5. Every proxy has independent thread pool.
  6. Load balance
    1. RandomLoadBalance
    2. ConsistentHash
    3. RoundRobinLoadBalance
    4. LeastActiveLoadBalance
  7. Support fuse service which is offline,then retest service in single thread,when it is reachable,take it online.
  8. Use epoll model in Linux,other uses nio model.
  9. Static file mapping.
  10. Support consul auto service discovery.if it is enable,origin mapping config will be failure,every node has same weight.
  11. Support zookeeper auto service discovery.If it is enable,origin mapping config will be failure,every node has same weight,zk priority is higher than consul.
  12. Print detail log in developer mode,and print log which level is higher than 'warn' in production environment.

Download

Download the latest release

Usage

  • start jar package

    java -jar gateway.jar -c /root/config.json
    1. -v version
    2. -c json config file path
    3. -h show help info
  • config.json

    {
      "mode": "dev",
      "http": {
        "port": 8080,
        "redirectHttps": false
      },
      "https": {
        "enable": false,
        "port": 8081,
        "keyPwd": "123456",
        "keyPath": "/Users/xxx/workspace/gateway/ssl/cwd.keystore"
      },
      "threadPool": {
        "core": 150,
        "max": 200,
        "timeout": 5000
      },
      "mapping": {
        "mode": "com.github.cwdtom.gateway.environment.lb.ConsistentHash",
        "list": {
          "127.0.0.1:8080": [
            {
              "url": "123.125.115.110:80",
              "weight": 200
            },
            {
              "url": "220.181.57.216:80",
              "weight": 100
            }
          ]
        }
      },
      "static": {
        "localhost:8080": "/Users/xxx/workspace/gateway"
      },
      "cors": {
        "enable": true,
        "allowMethods": "GET, POST, HEAD, PUT, PATCH, DELETE",
        "whiteList": []
      },
      "flowLimits": {
        "enable": true,
        "timeout": 500,
        "rate": 5,
        "maxSize": 200
      },
      "filter": {
        "before": [
          "com.github.cwdtom.gateway.filter.BeforeTestFilter"
        ],
        "after": [
          "com.github.cwdtom.gateway.filter.AfterTestFilter"
        ]
      },
      "consul": {
        "enable": true,
        "host": "192.168.0.236:8500",
        "mapping": {
          "test": [
            "localhost:8080"
          ]
        }
      },
      "zk": {
        "enable": true,
        "host": "127.0.0.1:2181",
        "mapping": {
          "test": [
            "localhost:8080"
          ]
        }
     }
    }
    1. mode: If it is not 'dev',nothing but log level higher than 'warn' print and shutdown resource leak detector.
    2. http: http config.
      1. port: http service port.
      2. redirectHttps: Whether need redirect https or not.
    3. https: https config.
      1. enable: enable https service.
      2. port: https service port.
      3. keyPwd: SSL certificate password.
      4. keyPath: SSL certificate file path.
    4. threadPool: single proxy thread pool config.
      1. core: core thread count.
      2. max: max thread count.
      3. timeout: thread pool timeout.
    5. mapping: mapping config,every host mapping multiple proxy address.
      1. mode: load balance algorithm,default RandomLoadBalance.
      2. list: mapping list.
        1. key: host.
        2. value: proxy address list.
          1. url: proxy address.
          2. weight: weight.
    6. static: static file mapping.
      1. key: host.
      2. value: local folder.
    7. cors: cors config.
      1. enable: enable cors.
      2. allowMethods: allowed request methods.
      3. whiteList: cors white list,when white list is empty and cors enable,allow all requested.
    8. flowLimits: flow limits config.
      1. enable: enable flow limits.
      2. rate: token production rate,unit millisecond.
      3. maxSize: token bucket size.
    9. filter: request filter,the execution order is same as this config.
      1. before: pre filter.
      2. after: post filter.
    10. consul: consul config.
      1. enable: enable consul,if enable origin mapping will be failure.
      2. host: consul address.
      3. mapping: service mapping.
        1. key: service name(spring.application.name).
        2. value: host list
    11. zk: zookeeper config
      1. enable: enable zookeeper,if enable origin mapping will be failure.
      2. host: zookeeper address
      3. mapping: service mapping.
        1. key: service name(spring.application.name).
        2. value: host list

CUSTOMIZE

  • Load balance algorithm:Support customize algorithm.Algorithm class need extends UrlMapping class.Father class has proxy mapping map variable.

    public class RandomLoadBalance extends UrlMapping {
        @Override
        public Mapper getLoadBalance(String host, String ip) {
            // do something
        }
    }
  • filter:Support customize filter.Filter class need implements BeforeFilter interface or AfterFilter interface.

    • pre filter,return whether continue or not.
    public class TestFilter implements BeforeFilter {
        @Override
        public boolean filter(FullHttpRequest request, byte[] content) {
            // do something
            return false;
        }
    }
    • post filter.
    public class TestFilter implements AfterFilter {  
        @Override
        public void filter(FullHttpResponse response) {
            // do something
        }
    }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].