• Stars
    star
    1,813
  • Rank 25,612 (Top 0.6 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created almost 7 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Enjoy games with your friends as if you were on a LAN.

switch-lan-play

Build status Chat on discord

English | 中文

Make you and your friends play games like in a LAN.

                     Internet
                        |
                  [SOCKS5 Proxy] (optional)
                        |
        ARP,IPv4        |          LAN Packets
Switch <-------->  PC(lan-play)  <-------------> Server
                                       UDP

NOTE:

  • This project is in an early stage. The protocol may change frequently.

Usage

To play with your friends, you and your friends should run lan-play client connecting to the same Server on your PC, and set static IP on your Switch.

Your PC and Switch must be connected to the same router.

Visit https://www.lan-play.com/ for steps on how to set this up. See below for build instructions.

SOCKS5 Proxy

lan-play --socks5-server-addr example.com:1080

Data sent to the relay server does not pass through the proxy.

Build

Debug or Release

cmake -DCMAKE_BUILD_TYPE=Debug .. cmake -DCMAKE_BUILD_TYPE=Release ..

Ubuntu / Debian

This project depends on libpcap, you can install libpcap0.8-dev on Ubuntu or Debian:

sudo apt install libpcap0.8-dev git gcc g++ cmake

Prepare a cmake, gcc, and run like this:

mkdir build
cd build
cmake ..
make

Windows

Use MSYS2 to compile.

pacman -Sy
pacman -S make \
    mingw-w64-x86_64-cmake \
    mingw-w64-x86_64-gcc

To compile 32bit program:

pacman -S mingw-w64-i686-cmake \
    mingw-w64-i686-gcc

Open MSYS2 MinGW 64-bit or MSYS2 MinGW 32-bit.

mkdir build
cd build
cmake -G "MSYS Makefiles" ..
make

Mac OS

brew install cmake
mkdir build
cd build
cmake ..
make

Server

Docker

docker run -d -p 11451:11451/udp -p 11451:11451/tcp spacemeowx2/switch-lan-play

Node

git clone https://github.com/spacemeowx2/switch-lan-play
cd switch-lan-play/server
npm install
npm run build # build ts to js. run it again when code changed.
npm start

Use --port pass the port parameter, or else it will use 11451/udp as default.

Use --simpleAuth pass the auth via username and password, or else there's no authentication.

Use --httpAuth pass the auth via http url, or else there's no authentication.

Use --jsonAuth pass the auth via json file, or else there's no authentication.

Example:

npm run build
npm start -- --port 10086 --simpleAuth username:password

Meanwhile the monitor service will be started on port 11451/tcp by default, you can get online client count via HTTP request:

Request: GET http://{YOUR_SERVER_IP}:11451/info

Response: { "online": 42 }

Protocol

The protocol is very simple now, but I'm going to add some fileds to calculate network quality(packet loss, ping), like timestamp, seq_id, etc.

struct packet {
    uint8_t type;
    uint8_t payload[packet_len - 1];
};
enum type {
    KEEPALIVE = 0,
    IPV4 = 1,
    PING = 2,
    IPV4_FRAG = 3
};

The server can read IP addresses from payload and save source IP -> LAN IP to a cache table. If target ip address shown in payload doesn't hit the cache, broadcast this packet to the entire room(now a server is a room).

More Repositories

1

ldn_mitm

Play local wireless supported games online
C++
713
star
2

DouyuHTML5Player

替换斗鱼的Flash弹幕播放器
TypeScript
600
star
3

slp-server-rust

Switch-lan-play Server written in Rust
Rust
117
star
4

s3si.ts

Export your battles from SplatNet to https://stat.ink
TypeScript
108
star
5

blflash

bl602 serial flasher
Rust
55
star
6

splatoon2-qqbot

主要用于 Splatoon2 群的机器人
TypeScript
38
star
7

LiveHelper

TypeScript
33
star
8

tokio-smoltcp

Async version of smoltcp
Rust
31
star
9

flash-emu

Run flascc in js
TypeScript
20
star
10

switch-ldn-tool

Rust
9
star
11

tauri-async-handler

Rust
7
star
12

switch-lan-play-gui

Vue
6
star
13

dc28-rhg

rhg subtree of my ctf git repo
TypeScript
6
star
14

splatoon-bot-2

TypeScript
6
star
15

obs-html

JavaScript
5
star
16

socks5-protocol

https://crates.io/crates/socks5-protocol
Rust
5
star
17

obs-plugins

C
4
star
18

ikaWidget2stat.ink

JavaScript
4
star
19

slp-tauri

TypeScript
3
star
20

splatoon3-record-bot

TypeScript
3
star
21

switch-lan-play-server

TypeScript
3
star
22

mouse2sixaxis

Don't use this
TypeScript
3
star
23

splatoon2-video

TypeScript
3
star
24

udp-listener

Rust
2
star
25

wlan-play

2
star
26

flv-keyframes

Rust
2
star
27

tofu

Rust
2
star
28

RemoteSwitchController

C
2
star
29

switch-pro-xy

A bluetooth proxy between Switch and Pro Controller.
Rust
2
star
30

ssl-mitm

Log data inside ssl
1
star
31

uit

UDP in TCP
Rust
1
star
32

html5-pip-extension

1
star
33

WebSheller

Python
1
star
34

devkitpro-action

1
star
35

100mb

a 100mb file, 0x00, 0x01, 0x02....0xfe, 0xff, 0x00, 0x01....
1
star
36

rust-channel-bench

Rust
1
star
37

tauri-actions

1
star
38

blog

1
star
39

splatoon2-discordbot

Dockerfile
1
star
40

chat-qq

TypeScript
1
star
41

apollo-template

TypeScript
1
star
42

spacemeowx2

1
star
43

amz_mitm

C++
1
star
44

lan-play-bot

TypeScript
1
star