Skip to content

Instantly share code, notes, and snippets.

View NNdroid's full-sized avatar
🎯
Focusing

NNdroid

🎯
Focusing
View GitHub Profile
@NNdroid
NNdroid / client.c
Created August 13, 2023 13:18 — forked from inaz2/client.c
IPv6 server & client in C
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
void ping(int s, char *message)
{
char buf[8192];
@NNdroid
NNdroid / LocalServerSocket.md
Created August 8, 2023 06:01 — forked from RajithaKumara/LocalServerSocket.md
Android create Unix domain socket by bound file descriptor

Android create Unix domain socket by bound file descriptor

Android provide LocalServerSocket and LocalSocket to create Unix domain sockets for local interprocess communication (IPC). Unix socket address can behave in three types[1],

  • pathname
  • unnamed
  • abstract

LocalServerSocket provide two public constructors for create socket in Linux abstract namespace[2] and create socket using file descriptor that's already been created and bound[3].

Create LocalServerSocket using [FileDescriptor](https://docs.oracle.com/javase/7/docs/api/j

iptables -t nat -A PREROUTING ! -s 10.42.0.1/32 ! -d 10.42.0.1/32 -p tcp -m tcp --dport 53 -j DNAT --to-destination 10.42.0.1:53
iptables -t nat -A PREROUTING ! -s 10.42.0.1/32 ! -d 10.42.0.1/32 -p udp -m udp --dport 53 -j DNAT --to-destination 10.42.0.1:53
@NNdroid
NNdroid / tun-ping-linux.go
Created July 18, 2023 14:18 — forked from glacjay/tun-ping-linux.go
Reading/Writing Linux's TUN/TAP device in Go.
package main
import (
"exec"
"log"
"os"
"syscall"
"unsafe"
)
@NNdroid
NNdroid / hev-socks5-tunnel-installer.sh
Created July 6, 2023 07:41
hev-socks5-tunnel installer
#!/bin/bash
RELEASE_API="https://api.github.com/repos/heiher/hev-socks5-tunnel/releases/latest"
BIN_DST_DIR=/usr/local/bin
RESOURCE_DST_DIR=/usr/local/etc/hev-socks5-tunnel
function getReleaseInfo() {
response=$(curl ${RELEASE_API})
if [ $? == 0 ]; then
echo $response
return 0
@NNdroid
NNdroid / hev-socks5-server-installer.sh
Last active January 16, 2026 22:00
hev-socks5-server installer
#!/bin/bash
RELEASE_API="https://api.github.com/repos/heiher/hev-socks5-server/releases/latest"
BIN_DST_DIR=/usr/local/bin
RESOURCE_DST_DIR=/usr/local/etc/hev-socks5-server
function getReleaseInfo() {
response=$(curl ${RELEASE_API})
if [ $? == 0 ]; then
echo $response
return 0
@NNdroid
NNdroid / sniproxy-installer.sh
Created June 7, 2023 12:40
sniproxy installer
#!/bin/bash
RELEASE_API="https://api.github.com/repos/XIU2/SNIProxy/releases/latest"
BIN_DST_DIR=/usr/local/bin
RESOURCE_DST_DIR=/usr/local/etc/sniproxy
function getReleaseInfo() {
response=$(curl ${RELEASE_API})
if [ $? == 0 ]; then
echo $response
return 0
#remove local 53 service
rm -rf /etc/resolv.conf
ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
sed -i 's/#DNS=/DNS=9.9.9.9/; s/#DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf
systemctl restart systemd-resolved
#install yggdrasil
wget -O yggdrasil.deb https://github.com/yggdrasil-network/yggdrasil-go/releases/download/v0.4.7/yggdrasil-0.4.7-amd64.deb
dpkg -i yggdrasil.deb
sed -i 's#^ Peers.*$# Peer\s\: \[\n tl\s\:\/\/supergay.network:443\n \]#g' /etc/yggdrasil.conf
sed -i 's/IfName: auto/IfName: ygg0/g' /etc/yggdrasil.conf
#!/bin/bash
PROXY=""
RELEASE_API="https://api.github.com/repos/librespeed/speedtest-go/releases/latest"
BIN_DST_DIR=/usr/local/bin
RESOURCE_DST_DIR=/usr/local/etc/speedtest-backend
function getReleaseInfo() {
response=$(curl ${RELEASE_API})
if [ $? == 0 ]; then
echo $response
@NNdroid
NNdroid / balance.go
Created May 30, 2023 00:03 — forked from darkhelmet/balance.go
Simple TCP load balancer in Go.
package main
import (
"flag"
"io"
"log"
"net"
"strings"
)