Skip to content

Instantly share code, notes, and snippets.

View Green-Sky's full-sized avatar
😜
*typing...*

Erik Scholz Green-Sky

😜
*typing...*
View GitHub Profile

Port forwarding in tox

(maybe more generic?)

This specification describes how 2 or more tox clients can setup and run tcp/udp traffic forwarding. A common usecase for this is securely exposing local webserver to a friend or forwarding game traffic without setting up a vpn or punching holes into a firewall.

Setup flow

If a successful setup is performed,

  • peer A sends an Offer to B,
@Green-Sky
Green-Sky / ngclist.md
Last active March 17, 2024 17:09
ngc list
title topics chatid
TokTok-Dev toxcore main dev 360497da684bce2a500c1af9b3a5ce949bbb9f6fb1f91589806fb04ca039e313
Lobby general offtopic d325f0095cb4d10f5ed668b854e2e10c131f7256949625e5e2dddadd8143dffa
TRIfA Community zoxcore and related 154b3973bd0e66304fd6179a8a54759073649e09e6e368f0334fc6ed666ab762
*nix C and unix/linux 42dc8eb4551ed602e56265e32cf3331c523b501454cfcba5294dd94c8d07149d
struct Header {
u32 magic;
u32 version;
u32 n_vocab;
u32 n_embd;
u32 n_mult;
u32 n_head;
u32 n_layer;
u32 n_rot;
#include "llama-util.h"
#include "llama.h"
int main(void) {
//llama_file_saver lfs{"ggml-bytewise-vocab.bin", nullptr, LLAMA_FTYPE_ALL_F32};
llama_file file{"ggml-bytewise-vocab.bin", "wb"};
// magic
file.write_u32(LLAMA_FILE_MAGIC); // magic
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
#rm ~/.config/tox/DHTnodes.json
for i in {0..19}
do
# inital setup client if save file does not exist
if [[ ! -f "tmp_tcp_ngc_$i.tox" ]]; then
@Green-Sky
Green-Sky / tox_save.py
Last active May 14, 2022 22:53
extract group save data from tox saves, convert binary to base64 and print as json. call tox_save_extract.py and change the path in from_file()
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
from enum import Enum
if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))
@Green-Sky
Green-Sky / tox_save.ksy
Created May 14, 2022 20:45
kaitai toxsave file wip ngc test
meta:
id: tox_save
license: CC0-1.0
ks-version: 0.9
endian: le
imports:
- /serialization/msgpack
doc: |
Toxcore save file parser (wip)
@Green-Sky
Green-Sky / tox_save.ksy
Created May 14, 2022 20:32
kaitai toxsave file wip v1
meta:
id: tox_save
file-extension: tox_save
license: CC0-1.0
ks-version: 0.9
endian: le
doc: |
Toxcore save file parser (wip)
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
rm ~/.config/tox/DHTnodes.json
for i in {0..19}
do
# inital setup client if save file does not exist
if [[ ! -f "tmp_udp_ngc_testnet$i.tox" ]]; then
@Green-Sky
Green-Sky / tox_save.hexpat
Created March 1, 2022 19:40
ImHex pattern file for toxcore save files
// tox save pattern for unencrypted data
#pragma endian little
#include <std/cint.pat>
#include <std/io.pat>
#include <std/sys.pat>
#include <std/mem.pat>