Giter Club home page Giter Club logo

spring-ws-tunnel's Introduction

spring-ws-tunnel

build main Maven Central

This project can turn any spring application into an API tunnel gateway, allowing a local server to act as one located in the same network the gateway is without requiring special routings (the client becomes the server and the server becomes the client).

This is achieved by using a webscoket connection as a tunnel to forward HTTP or other WS requests.

Any remote communication (HTTP or WS) following a client -> server model:

Can be tunneled to a local server:

Libraries

  • spring-ws-tunnel-core: main tunneling functionality. This library is required to setup your tunnel gateway.
  • spring-ws-tunnel-demo-server: minimal server setup example. It showcases the tunneling system, including a Web UI (tunnel client) served as an static application.

Tunnel Setup

Once included the library in the application (io.github.nemesismate:spring-ws-tunnel-core), enabling the tunnel functionality is done with the relevant annotations.

@EnableTunnelHttpApi
@EnableTunnelWsApi
@SpringBootApplication
public class TunnelApplication {

    public static void main(String[] args) {
        SpringApplication.run(TunnelApplication.class, args);
    }

}

The application will complain if the tunneling is enabled but a TunnelListener bean doesn't exist.

@Bean
public TunnelListener tunnelListener() {
    return TunnelListener.Default.builder()
            .onTunnelCreate(id -> {
                System.out.println("Created tunnel: " + id);
                return true;
            })
            .onTunnelDelete(id -> System.out.println("Deleted tunnel: " + id))
            .build();
}

Tunnel Setup - Spring Cloud Gateway (WIP)

A very simple and powerful approach to setup this Tunnel applicationis with Spring Cloud Gateway.

spring-ws-tunnel's People

Contributors

nemesismate avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.