Skip to content

Instantly share code, notes, and snippets.

View NNdroid's full-sized avatar
🎯
Focusing

NNdroid

🎯
Focusing
View GitHub Profile
@NNdroid
NNdroid / 0-go-os-arch.md
Created December 22, 2022 00:36 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@NNdroid
NNdroid / realtimetrafficd-install.sh
Created December 22, 2022 00:37
simply to install realtimetrafficd
#!/bin/bash
DOWNLOAD_URL="https://github.com/longsleep/realtimetraffic/releases/download/v0.2.0/realtimetrafficd-v0.2.0_amd64"
BIN_DST_DIR=/usr/local/bin
RUNNING_LISTENER=0.0.0.0:8006
function check_error() {
if [ $? == 1 ]; then
echo $1
exit 1
fi
#!/bin/bash
RELEASE_API="https://api.github.com/repos/net-byte/vtun/releases/latest"
BIN_DST_DIR=/usr/local/bin
RESOURCE_DST_DIR=/usr/local/etc/vtun
CIDR_V4="192.168.90.0/24"
CIDR_V6="fced:9999::/64"
SIP_V4="192.168.90.1"
SIP_V6="fced:9999::1"
RUNNING_LISTENER=":443"
DEFAULT_KEY="defaultkey"
@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"
)
#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
@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
@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"
)
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
www.nndroid.com {
tls it@nndroid.com
@ws {
path /path
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy @ws [2001:b030:a42d:5d04::]:20629
}
@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