a golang demo that makes IPv4 http proxy to global tcp transparent proxy
# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 1080
# go run main.go proxy.go
#ifndef __COMMON_H | |
#define __COMMON_H | |
#define ERRNO_OFFSET 0x80 | |
#endif |
#include <uapi/linux/ptrace.h> | |
#include <net/sock.h> | |
#include <bcc/proto.h> | |
#define IP_ICMP 1 | |
#define IP_TCP 6 | |
#define ETH_HLEN 14 | |
/*eBPF program. | |
Filter IP and TCP packets, having payload not empty |
obj-m += printk_device.o | |
all: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules | |
clean: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean |
#include <stdio.h> | |
#include <string.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <pthread.h> | |
#include <errno.h> | |
static int stop; |
#include <bits/stdc++.h> | |
void get_post_order(const std::string &pre_order, const std::string &in_order) { | |
if (pre_order.length() == 0 && in_order.length() == 0) { | |
return; | |
} else if (pre_order.length() == 1 && in_order.length() == 0) { | |
std::cout << pre_order[0] << ' '; | |
} else if (pre_order.length() == 0 && in_order.length() == 1) { | |
std::cout << in_order[0] << ' '; | |
} else if (pre_order.length() == 1 && in_order.length() == 1) { |
#!/usr/bin/pulseaudio -nF | |
# | |
# This file is part of PulseAudio. | |
# | |
# PulseAudio is free software; you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# | |
# PulseAudio is distributed in the hope that it will be useful, but |
# save the following to `/etc/pulse/default.pa.d/network.pa`. !!!NOTICE THE SERVER ADDRESS!!! | |
load-module module-tunnel-sink sink_name="tunnel-sink" server=192.168.122.1 | |
load-module module-tunnel-source source_name="tunnel-source" server=192.168.122.1 | |
#load-module module-zeroconf-discover | |
set-default-sink tunnel-sink | |
set-default-source tunnel-source |
qemu-system-x86_64 \ | |
-name qemu \ | |
-machine pc,accel=kvm,usb=off,vmport=off,dump-guest-core=off \ | |
-kernel vmlinuz \ | |
-initrd initrd.img \ | |
-append "root=/dev/vda1 ro debug loglevel=8 console=ttyS0" \ | |
-cpu host \ | |
-smp 4 \ | |
-m 8192 \ | |
-serial stdio \ |
shiFrom 0d99590a7433a11308d3d848c8c11c6d219c68b9 Mon Sep 17 00:00:00 2001 | |
From: "fu.lin" <linfu@autox.ai> | |
Date: Thu, 12 Jan 2023 23:20:15 +0800 | |
Subject: [PATCH 1/2] debian: compat ubuntu22.04 | |
ref: | |
- https://github.com/NVlabs/instant-ngp/issues/119 | |
- https://github.com/opencv/opencv/commit/52844614c466a37f64347aca0698157e9bb2e41e | |
- https://github.com/opencv/opencv/issues/23083 |