Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
# 15/5/21
# create by: snower
import sys
import socket
import struct
from sevent import udp
from sevent import current
@snower
snower / echo.c
Created April 25, 2019 08:53
benchmark-echo
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h> //strlen
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h> //inet_addr
#include <pthread.h>
#include <time.h>
@snower
snower / tcp2proxy.py
Last active July 9, 2020 07:02
tcp2proxy
# -*- coding: utf-8 -*-
# 2020/3/4
# create by: snower
import sys
import time
import logging
import struct
import socket
import traceback
@snower
snower / simple_proxy.py
Created July 9, 2020 03:10
simple_proxy
# -*- coding: utf-8 -*-
# 2020/7/8
# create by: snower
import sys
import time
import struct
import socket
import logging
import traceback
@snower
snower / check_ip.py
Last active December 28, 2021 09:57
check_ip
# -*- coding: utf-8 -*-
#14-6-6
# create by: snower
import struct
from collections import defaultdict
import socket
default_networds = (
@snower
snower / tcp2proxys.py
Created August 19, 2021 14:14
tcp2proxys
# -*- coding: utf-8 -*-
# 2021/8/19
# create by: snower
import argparse
import logging
import sevent
from sevent.helpers import tcp2proxy
@snower
snower / poll.conf
Created December 28, 2021 09:56
openresty long polling server
init_worker_by_lua_block {
local slock = require "slock"
slock:connect("server1", "127.0.0.1", 5658)
}
server {
listen 8081;
default_type application/json;
location /poll/event {
@snower
snower / arproxy.py
Last active January 15, 2022 11:14
arproxy
# -*- coding: utf-8 -*-
# 2020/7/10
# create by: snower
from sevent.helpers.tcp2proxy import *
def check_host(forward_host, allow_hosts):
for host in allow_hosts:
if forward_host == host or forward_host.endswith(host):
return True
@snower
snower / main.go
Created March 18, 2022 14:21
charles register
package main
import (
"bytes"
"encoding/binary"
"fmt"
"math/rand"
"time"
)
@snower
snower / forward.py
Last active June 10, 2023 09:14
SSH、HTTP和HTTPS复用端口自动分流
# -*- coding: utf-8 -*-
# 2023/2/7
# create by: snower
import sevent
PORT = 80
SSH_ADDRES = ("127.0.0.1", 2222)
HTTP_ADDRES = ("127.0.0.1", 8080)
HTTPS_ADDRES = ("127.0.0.1", 4443)