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...
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

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! 🎶

WebSocket-to-HTTP reverse proxy

websocket-bridge This is a simple reverse proxy server which accepts WebSocket connections and forwards any incoming frames to backend HTTP server(s)

A secure, real-time, low-latency binary WebSocket RPC subprotocol.

HardLight A secure, real-time, low-latency binary WebSocket RPC subprotocol. HardLight has two data models: RPC: a client connects to a server, and ca

Another Network Tunnel; A simple program for local/remote port forwarding over a SSH tunnel.

🐜 ANT Another Network Tunnel; A simple program for local/remote port forwarding over a SSH tunnel. Table of Contents Installation Pre-requisites Pre-

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 highly customizable, full scale web backend for web-rwkv, built on axum with websocket protocol.

web-rwkv-axum A axum web backend for web-rwkv, built on websocket. Supports BNF-constrained grammar, CFG sampling, etc., all streamed over network. St

This is the weirdest thing I've ever seen

strange-config-format I got nerdsniped on Twitter. Here's the fastest way to get a solution I could manage. It took about 90 minutes. Usage $ cargo ru

Dura - You shouldn't ever lose your work if you're using Git

Dura Dura is a background process that watches your Git repositories and commits your uncommitted changes without impacting HEAD, the current branch,

ever wanted to leave all slack channels? now you can!

slack-leaver ever wanted to leave all slack channels? now you can! usage Head to the Releases page, pick a release that matches your platform. from so

Ever got frustrated when you realize that the for loop you were writing

for_each_repeat Ever got frustrated when you realize that the for loop you were writing... fn foo(mut iter: impl IteratorItem=i32) { for i in it

Ever wanted to torture your CPU by generating every image possible?

dumpsterfire Ever wanted to torture your CPU by generating every image possible? Well, now you can! This thing is worse than mining Bitcoin, since the

A library for loading and executing PE (Portable Executable) from memory without ever touching the disk

memexec A library for loading and executing PE (Portable Executable) from memory without ever touching the disk This is my own version for specific pr

The last kubernetes tool you'll ever need.

Neatkube The last kubernetes tool you'll ever need. Kubernetes is a mess. Everthing ships it's own command line tools that you need to install and tra

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

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
  • UDP Over Websocket

    UDP Over Websocket

    Hello,

    Uot feature doesn't work over websocket tunnel and I actually couldn't figure it out why it faces buf.len() < 14 issue from lightws's connector/accecptor even if you give it a large enough buffer.

    Related: #7

    opened by sabify 0
  • 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
A WebSocket (RFC6455) library written in Rust

Rust-WebSocket Note: Maintainership of this project is slugglish. You may want to use tungstenite or tokio-tungstenite instead. Rust-WebSocket is a We

Rust Websockets 1.3k Jan 6, 2023
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.3k Jan 2, 2023
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 94 Dec 30, 2022
A CLI development tool for WebSocket APIs

A CLI development tool for WebSocket APIs

Espen Henriksen 622 Dec 26, 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 91 Jan 5, 2023
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 94 Dec 30, 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