The ever fast websocket tunnel built on top of lightws

Related tags

WebSocket kaminari
Overview

Kaminari

The ever fast websocket tunnel built on top of lightws.

Intro

  • Client side receives tcp then sends [tcp/ws/tls/wss].

  • Server side receives [tcp/ws/tls/wss] then sends tcp.

  • Compatible with shadowsocks SIP003 plugin.

 tcp                           ws/tls/wss                           tcp
 ===                          ============                          ===
        +-------------------+              +-------------------+
        |                   |              |                   |
+------->                   +-------------->                   +------->
        |     kaminaric     |              |     kaminaris     |
<-------+                   <--------------+                   <-------+
        |                   |              |                   |
        +-------------------+              +-------------------+       

Usage

Standalone:

kaminaric <local_addr> <remote_addr> <options>

kaminaris <local_addr> <remote_addr> <options>

As shadowsocks plugin:

sslocal ... --plugin <path/to/kaminaric> --plugin-opts <options>

ssserver ... --plugin <path/to/kaminaris> --plugin-opts <options>

Options

All options are presented in a single formatted string. An example is "ws;path=/ws;host=example.com", where semicolons, equal signs and backslashes MUST be escaped with a backslash.

Websocket Options

use ws to enable websocket.

Client or server side options:

  • host=: set http host.

  • path=: set http path.

TLS Options

use tls to enable tls.

Client side options:

  • sni=: set sni.

  • 0rtt: enable early data.

  • insecure: skip server cert verification.

Server side options:

  • key=: private key path.

  • cert=: certificate path.

  • servername=: generate self signed cert/key, use $name as CN.

Examples

tcp ⇋ ws --- ws ⇋ tcp:

kaminaric 127.0.0.1:10000 127.0.0.1:20000 'ws;host=example.com;path=/ws'

kaminaris 127.0.0.1:20000 127.0.0.1:30000 'ws;host=example.com;path=/ws'

tcp ⇋ tls --- tls ⇋ tcp:

kaminaric 127.0.0.1:10000 127.0.0.1:20000 'tls;sni=example.com;insecure'

# use cert + key
kaminaris 127.0.0.1:20000 127.0.0.1:30000 'tls;cert=example.com.crt;key=example.com.key'

# generate self signed cert/key
kaminaris 127.0.0.1:20000 127.0.0.1:30000 'tls;servername=example.com'

tcp ⇋ wss --- wss ⇋ tcp:

kaminaric 127.0.0.1:10000 127.0.0.1:20000 'ws;host=example.com;path=/ws;tls;sni=example.com;insecure'

# use cert + key
kaminaris 127.0.0.1:20000 127.0.0.1:30000 'ws;host=example.com;path=/ws;tls;cert=example.com.crt;key=example.com.key'

# generate self signed cert/key
kaminaris 127.0.0.1:20000 127.0.0.1:30000 'ws;host=example.com;path=/ws;tls;servername=example.com'
You might also like...
websocket client

#websocket client async fn test_websocket()-anyhow::Result() { wasm_logger::init(wasm_logger::Config::default()); let (tx, rx) = futures_c

A webserver and websocket pair to stop your viewers from spamming !np and
A webserver and websocket pair to stop your viewers from spamming !np and "what's the song?" all the time.

spotify-np 🦀 spotify-np is a Rust-based local webserver inspired by l3lackShark's gosumemory application, but the catch is that it's for Spotify! 🎶

An easy-to-use tunnel to localhost built in Rust. An alternative to ngrok and frp.

rslocal English | 中文 What is rslocal? Rslocal is like ngrok built in Rust, it builds a tunnel to localhost. Project status support http support tcp su

A simple UI framework for Rust built on top of IUP (http://webserver2.tecgraf.puc-rio.br/iup/)

KISS-UI A UI framework for Rust based on the KISS (Keep It Simple, Stupid!) philosophy. Powered by the IUP GUI library for C by Tecgraf, via the bindi

Playwright is a rust library to automate Chromium, Firefox and WebKit built on top of Node.js library.

🎭 Playwright for Rust Playwright is a rust library to automate Chromium, Firefox and WebKit built on top of Node.js library. Installation [dependenci

Parallel finance a decentralized lending protocol built on top of the Polkadot ecosystem. Our unique approach will allow users to earn
Parallel finance a decentralized lending protocol built on top of the Polkadot ecosystem. Our unique approach will allow users to earn "double interests" from staking and lending their tokens simultaneously.

Parallel Finance A new Cumulus-based Substrate node, ready for hacking 🚀 Getting Started Follow these steps to get started with the Cumulus Template

Scion is a tiny 2D game library built on top of wgpu, winit and legion.
Scion is a tiny 2D game library built on top of wgpu, winit and legion.

Scion is a 2D game library made in rust. Please note that this project is in its first milestones and is subject to change according to convience need

Metaplex is a protocol built on top of Solana that allows: Creating/Minting non-fungible tokens;
Metaplex is a protocol built on top of Solana that allows: Creating/Minting non-fungible tokens;

Metaplex is a protocol built on top of Solana that allows: Creating/Minting non-fungible tokens; Starting a variety of auctions for primary/secondary

A cookie manager middleware built on top of tower.

tower-cookies A cookie manager middleware built on top of tower. Example With axum: use axum::{handler::get, Router}; use std::net::SocketAddr; use to

3d transformation gizmo built on top of the egui library.
3d transformation gizmo built on top of the egui library.

egui-gizmo 3d transformation gizmo built on top of the egui library. Try it out in a web demo Usage let gizmo = Gizmo::new("My gizmo") .view_matri

 Gecko is a high-level, general-purpose programming language built on top of the LLVM project.
Gecko is a high-level, general-purpose programming language built on top of the LLVM project.

Gecko is a high-level, general-purpose programming language built on top of the LLVM project. Gecko Technology & principles Gecko is a general-purpose

Simple WIP GPGPU framework for Rust built on top of wgpu

gpgpu A simple GPU compute library based on wgpu. It is meant to be used alongside wgpu if desired. To start using gpgpu, just create a Framework inst

Livny is a modern JavaScript and TypeScript runtime built on top of Rust

Livny is a modern JavaScript and TypeScript runtime built on top of Rust, Golang and the GraalVM Polyglot infrastructure that can run all of Deno and Node.jS applications. It is fine-tuned for user satisfaction, performance and security.

Streaming Network Overlay Connection Arbitration Tunnel

SNOCAT Streaming Network Overlay Connection Arbitration Tunnel snocat is a framework for forwarding streams across authenticated, encrypted QUIC tunne

A Rust implementation of Trojan with QUIC tunnel, Lite-TLS and more.

Trojan-Oxide A Rust implementation of Trojan with QUIC tunnel, Lite-TLS and more. Overview Full support for the original Trojan Protocol, including TC

Tunnel TCP traffic through SOCKS5 or HTTP using a TUN interface.

tun2proxy Tunnel TCP traffic through SOCKS5 or HTTP on Linux. Authentication not yet supported. Error handling incomplete and too restrictive. Build C

A remote shell, TCP tunnel and HTTP proxy for Replit.
A remote shell, TCP tunnel and HTTP proxy for Replit.

Autobahn A remote shell, TCP tunnel and HTTP proxy for Replit. Hybrid SSH/HTTP server for Replit. Based on leon332157/replish. Autobahn runs a WebSock

Proxy sentry request to a sentry server using a tunnel/proxy endpoint

Sentry Tunnel This is a proxy that forwards tunneled sentry requests to the real sentry server. The implementation is based on the explanation provide

A modern, simple TCP tunnel in Rust that exposes local ports to a remote server, bypassing standard NAT connection firewalls
A modern, simple TCP tunnel in Rust that exposes local ports to a remote server, bypassing standard NAT connection firewalls

bore A modern, simple TCP tunnel in Rust that exposes local ports to a remote server, bypassing standard NAT connection firewalls. That's all it does:

Comments
  • Plugin service exit unexpectedly as SIP003 plugin

    Plugin service exit unexpectedly as SIP003 plugin

    Server: Debian 10 x64, shadowsocks-libev 3.3.5 with kaminaris linux gcc x64 0.5.6 as plugin, plugin_opts ws;host=example.com;path=/ws

    Client: Openwrt 21.02.0 x64, shadowsocks-libev 3.3.5 with kaminaric linux musl x64 0.5.6 as plugin, plugin_opts ws;host=example.com;path=/ws

    I noticed when the connection to server is unstable, kaminaric will sometimes cause shadowsocks instance to terminate, with log daemon.err ss-redir[19787]: plugin service exit unexpectedly

    opened by terrytw 6
  • error[E0432]: unresolved import `std::io::ReadBuf`

    error[E0432]: unresolved import `std::io::ReadBuf`

    alpine linux v3.15 kernel 4.19.176-0-vanilla rustc 1.56.1 cargo 1.56.0

    localhost:~/kaminari# cargo b
       Compiling lightws v0.6.2
    error[E0432]: unresolved import `std::io::ReadBuf`
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/stream/read.rs:61:13
       |
    61 |         use std::io::ReadBuf;
       |             ^^^^^^^^^^^^^^^^ no `ReadBuf` in `io`
    
    error[E0554]: `#![feature]` may not be used on the stable release channel
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/lib.rs:2:1
      |
    2 | #![feature(const_slice_from_raw_parts)]
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0554]: `#![feature]` may not be used on the stable release channel
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/lib.rs:3:1
      |
    3 | #![feature(const_mut_refs)]
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0554]: `#![feature]` may not be used on the stable release channel
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/lib.rs:4:1
      |
    4 | #![feature(const_slice_index)]
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0554]: `#![feature]` may not be used on the stable release channel
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/lib.rs:5:1
      |
    5 | #![feature(read_buf)]
      | ^^^^^^^^^^^^^^^^^^^^^
    
    error[E0554]: `#![feature]` may not be used on the stable release channel
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/lib.rs:6:1
      |
    6 | #![feature(ready_macro)]
      | ^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0554]: `#![feature]` may not be used on the stable release channel
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/lib.rs:7:1
      |
    7 | #![feature(future_poll_fn)]
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0554]: `#![feature]` may not be used on the stable release channel
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/lib.rs:8:1
      |
    8 | #![feature(specialization)]
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error[E0658]: default values for const generic parameters are experimental
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/handshake/request.rs:37:47
       |
    37 | pub struct Request<'h, 'b: 'h, const N: usize = MAX_ALLOW_HEADERS> {
       |                                               ^^^^^^^^^^^^^^^^^^^
       |
       = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
    
    error[E0658]: default values for const generic parameters are experimental
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/handshake/response.rs:34:48
       |
    34 | pub struct Response<'h, 'b: 'h, const N: usize = MAX_ALLOW_HEADERS> {
       |                                                ^^^^^^^^^^^^^^^^^^^
       |
       = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
    
    error[E0658]: use of unstable library feature 'vec_spare_capacity'
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/stream/read.rs:73:52
       |
    73 |             let mut read_buf = ReadBuf::uninit(buf.spare_capacity_mut());
       |                                                    ^^^^^^^^^^^^^^^^^^
       |
       = note: see issue #75017 <https://github.com/rust-lang/rust/issues/75017> for more information
    
    error[E0599]: no method named `read_buf` found for mutable reference `&mut stream::Stream<IO, Role, Guarded>` in the current scope
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lightws-0.6.2/src/stream/read.rs:80:24
       |
    80 |             match self.read_buf(&mut read_buf) {
       |                        ^^^^^^^^ method not found in `&mut stream::Stream<IO, Role, Guarded>`
       |
       = help: items from traits can only be used if the trait is implemented and in scope
       = note: the following trait defines an item `read_buf`, perhaps you need to implement it:
               candidate #1: `AsyncReadExt`
    
    Some errors have detailed explanations: E0432, E0554, E0599, E0658.
    For more information about an error, try `rustc --explain E0432`.
    error: could not compile `lightws` due to 12 previous errors
    
    
    opened by shirakun 1
  • Is it possible to precompile for mips and mipsel?

    Is it possible to precompile for mips and mipsel?

    First of all, thanks for this project, great work!

    It seems that the binary files size is quite small.

    I am thinking about running these on a router if possible.

    enhancement 
    opened by terrytw 5
Releases(v0.5.7)
Owner
zephyr
amateur player, code for fun
zephyr
Lightweight stream-based WebSocket implementation for Rust.

Tungstenite Lightweight stream-based WebSocket implementation for Rust. use std::net::TcpListener; use std::thread::spawn; use tungstenite::server::ac

Snapview GmbH 1.2k Dec 1, 2022
Websocket generic library for Bitwyre WS-API

Websocket Core (Rust) Websocket generic server library for: Periodic message broadcast Eventual (Pubsub) message broadcast Async request reply Authors

Bitwyre 13 Oct 28, 2022
Jamsocket is a lightweight framework for building WebSocket-based application backends.

Jamsocket is a lightweight framework for building services that are accessed through WebSocket connections.

null 92 Nov 17, 2022
A CLI development tool for WebSocket APIs

A CLI development tool for WebSocket APIs

Espen Henriksen 621 Oct 18, 2022
Spawn process IO to websocket with full PTY support.

Cliws Spawn process IO to websocket with full PTY support. Features Any process IO through Websocket Full pty support: VIM, SSH, readline, Ctrl+X Auto

B23r0 88 Nov 17, 2022
A lightweight framework for building WebSocket-based application backends.

Jamsocket Jamsocket is a lightweight framework for building services that are accessed through WebSocket connections. Services can either be native Ru

drifting in space 91 Nov 25, 2022
A WebSocket (RFC6455) library written in Rust

Rust-WebSocket Rust-WebSocket is a WebSocket (RFC6455) library written in Rust. Rust-WebSocket provides a framework for dealing with WebSocket connect

Jason N 19 Aug 22, 2022
An aria2 websocket jsonrpc in Rust.

aria2-ws An aria2 websocket jsonrpc in Rust. Built with tokio. Docs.rs aria2 RPC docs Features Almost all methods and structed responses Auto reconnec

null 8 Sep 7, 2022
A simple toy websocket client to connect to Bitstamp.net and print the live order book written in Rust.

A simple toy websocket client to connect to Bitstamp.net and print the live order book written in Rust.

Nate Houk 1 Feb 14, 2022
Lightweight websocket implement for stream transmission.

Lightws Lightweight websocket implement for stream transmission. Features Avoid heap allocation. Avoid buffering frame payload. Use vectored-io if ava

zephyr 21 Oct 27, 2022