penguin/tinyproxy

An L4 proxy designed to act as a tiny transparent shim

commit 9925f6e109223918e31c3ba7a25d16683129b29f

author斟酌 鵬兄 <tgckpg@gmail.com>
date2026-05-27T14:51:15Z
subjectMoved files into src/
commit 9925f6e109223918e31c3ba7a25d16683129b29f
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2026-05-27T14:51:15Z

    Moved files into src/
---
 Dockerfile                               |  7 ++++---
 Makefile                                 | 13 ++++---------
 compat_socket.h => src/compat_socket.h   |  0
 env.c => src/env.c                       |  0
 env.h => src/env.h                       |  0
 file_conf.c => src/file_conf.c           |  0
 file_conf.h => src/file_conf.h           |  0
 klog.c => src/klog.c                     |  0
 klog.h => src/klog.h                     |  0
 proxy_proto_v2.c => src/proxy_proto_v2.c |  0
 proxy_proto_v2.h => src/proxy_proto_v2.h |  0
 route.c => src/route.c                   |  0
 route.h => src/route.h                   |  0
 signal.c => src/signal.c                 |  0
 signal.h => src/signal.h                 |  0
 tcp_route.c => src/tcp_route.c           |  0
 tcp_route.h => src/tcp_route.h           |  0
 tinyproxy.c => src/tinyproxy.c           |  0
 udp_route.c => src/udp_route.c           |  0
 udp_route.h => src/udp_route.h           |  0
 20 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 4be0800..1c270c3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,10 +3,11 @@ FROM alpine:3.23 AS build
 RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \
 	apk add --update-cache build-base libevent-dev libevent-static
 
-RUN mkdir /src
-WORKDIR /src
+RUN mkdir /build
+WORKDIR /build
 
-COPY [ "*.c", "*.h", "*.conf", "Makefile", "/src" ]
+COPY [ "*.conf", "Makefile", "/build" ]
+COPY ./src /build/src
 
 RUN make all STATIC=1
 
diff --git a/Makefile b/Makefile
index d037068..9807c82 100644
--- a/Makefile
+++ b/Makefile
@@ -7,18 +7,13 @@ STRIP ?= strip
 PKG_CONFIG ?= pkg-config
 
 PROJECT_ROOT := $(CURDIR)
+SRC_DIR := src
 BIN_DIR := $(CURDIR)/bin
 BUILD_DIR := $(PROJECT_ROOT)/build
 
-SRC := klog.c \
-       proxy_proto_v2.c \
-       signal.c \
-       route.c \
-       tcp_route.c \
-       udp_route.c \
-	   env.c \
-       file_conf.c \
-       tinyproxy.c
+BIN := $(BIN_DIR)/tinyproxy
+
+SRC := $(wildcard $(SRC_DIR)/*.c)
 
 EXEEXT :=
 WINDOWS_LDLIBS :=
diff --git a/compat_socket.h b/src/compat_socket.h
similarity index 100%
rename from compat_socket.h
rename to src/compat_socket.h
diff --git a/env.c b/src/env.c
similarity index 100%
rename from env.c
rename to src/env.c
diff --git a/env.h b/src/env.h
similarity index 100%
rename from env.h
rename to src/env.h
diff --git a/file_conf.c b/src/file_conf.c
similarity index 100%
rename from file_conf.c
rename to src/file_conf.c
diff --git a/file_conf.h b/src/file_conf.h
similarity index 100%
rename from file_conf.h
rename to src/file_conf.h
diff --git a/klog.c b/src/klog.c
similarity index 100%
rename from klog.c
rename to src/klog.c
diff --git a/klog.h b/src/klog.h
similarity index 100%
rename from klog.h
rename to src/klog.h
diff --git a/proxy_proto_v2.c b/src/proxy_proto_v2.c
similarity index 100%
rename from proxy_proto_v2.c
rename to src/proxy_proto_v2.c
diff --git a/proxy_proto_v2.h b/src/proxy_proto_v2.h
similarity index 100%
rename from proxy_proto_v2.h
rename to src/proxy_proto_v2.h
diff --git a/route.c b/src/route.c
similarity index 100%
rename from route.c
rename to src/route.c
diff --git a/route.h b/src/route.h
similarity index 100%
rename from route.h
rename to src/route.h
diff --git a/signal.c b/src/signal.c
similarity index 100%
rename from signal.c
rename to src/signal.c
diff --git a/signal.h b/src/signal.h
similarity index 100%
rename from signal.h
rename to src/signal.h
diff --git a/tcp_route.c b/src/tcp_route.c
similarity index 100%
rename from tcp_route.c
rename to src/tcp_route.c
diff --git a/tcp_route.h b/src/tcp_route.h
similarity index 100%
rename from tcp_route.h
rename to src/tcp_route.h
diff --git a/tinyproxy.c b/src/tinyproxy.c
similarity index 100%
rename from tinyproxy.c
rename to src/tinyproxy.c
diff --git a/udp_route.c b/src/udp_route.c
similarity index 100%
rename from udp_route.c
rename to src/udp_route.c
diff --git a/udp_route.h b/src/udp_route.h
similarity index 100%
rename from udp_route.h
rename to src/udp_route.h