Skip to content

Instantly share code, notes, and snippets.

@shankerwangmiao
shankerwangmiao / 60-stream.conf
Last active September 13, 2018 04:16
nginx-transp-proxy
stream {
log_format main '$remote_addr:$remote_port => $server_addr:$server_port'
' [$time_local] $protocol $status $bytes_sent $bytes_received '
'$session_time "$ssl_preread_server_name" $will_bind_local_addr';
server {
listen 127.0.0.1:3003 transparent;
proxy_pass $real_connect_to;
proxy_bind $will_bind_local_addr;
@shankerwangmiao
shankerwangmiao / nginx-ip-transp.patch
Last active October 11, 2023 04:15
nginx-ip-transp
diff --git a/auto/unix b/auto/unix
index 43d3b25..2b229f7 100644
--- a/auto/unix
+++ b/auto/unix
@@ -312,6 +312,17 @@ ngx_feature_test="cpu_set_t mask;
. auto/feature
+ngx_feature="IP_TRANSPARENT"
+ngx_feature_name="NGX_HAVE_TRANSPARENT"
#!/bin/bash
keyserver=${KEYSERVER:-"hkp://sks.ustclug.org"}
gpghome=/home/mirrors-web-trustdb
if [ -d .git/ ]; then
commit=$(git cat-file commit HEAD | sed '/^gpgsig/,/-----END PGP SIGNATURE-----$/ D')
sig=$(git cat-file commit HEAD | sed -n '/^gpgsig/,/-----END PGP SIGNATURE-----$/ P' | sed 's/^gpgsig//; s/^ //')
if [ -e "$gpghome/trustdb.gpg" ]; then
#!/bin/bash
function gen {
dd if=/dev/urandom 2>/dev/null | tr -dc a-f0-9 | fold -w $1 | head -n 1 | sed 's/^/0x/'
}
spi=`gen 8`
reqid=`gen 8`
auth_key=`gen 64`
enc_key=`gen 64`
#!/bin/bash
function load_var {
eval $(cat ${1} <( echo -e '\nset -o posix;set\n') | env - bash --noprofile --norc --posix | sed 's/^/'$2'_/')
if [ -n "$IF_IPSEC6" ]; then
PEER_ENDPOINT=$PEER_ENDPOINT6
SELF_ENDPOINT=$SELF_ENDPOINT6
fi
}