diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..788bbd6 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,4 @@ +v0.1.0 (2015-4-03) +----------- +* The first public version. + diff --git a/Makefile b/Makefile index c8c9e3e..09f9660 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ MAJOR = 0 MINOR = 1 -PATCH = 0 +PATCH = 1 NAME = xsocks ifdef O @@ -25,21 +25,21 @@ BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd) $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist)) endif # ifneq ($(BUILD_DIR),) +INSTALL_DIR := /usr/local/bin + OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR)) SRCTREE := $(CURDIR) -TOPDIR := $(SRCTREE) -export TOPDIR SRCTREE OBJTREE +export SRCTREE OBJTREE ######################################################################### -# CROSS_COMPILE = mips-openwrt-linux- - ifdef CROSS CROSS_COMPILE = $(CROSS) endif ifdef CROSS_COMPILE -CPPFLAGS += -DCROSS_COMPILE +CPPFLAGS = -DCROSS_COMPILE +HOST = $(patsubst %-,%,$(CROSS_COMPILE)) endif CFLAGS = \ @@ -48,9 +48,7 @@ CFLAGS = \ -Wall \ $(PLATFORM_CFLAGS) -CFLAGS += -ffunction-sections -fdata-sections -#CFLAGS += -g - +CFLAGS += -fomit-frame-pointer -fdata-sections -ffunction-sections EXTRA_CFLAGS = ######################################################################### @@ -63,16 +61,20 @@ LDFLAGS += -pthread -ldl -lrt LDFLAGS += 3rd/libuv/.libs/libuv.a 3rd/libsodium/src/libsodium/.libs/libsodium.a ######################################################################### -include $(TOPDIR)/config.mk +include $(SRCTREE)/config.mk ######################################################################### +ifndef CROSS_COMPILE all: libuv libsodium c-ares xsocksd xsocks xtproxy xforwarder xtunnel +else +all: libuv libsodium xsocks xtproxy xforwarder xtunnel +endif 3rd/libuv/autogen.sh: $(Q)git submodule update --init 3rd/libuv/Makefile: | 3rd/libuv/autogen.sh - $(Q)cd 3rd/libuv && ./autogen.sh && ./configure --host=$(patsubst %-,%,$(CROSS_COMPILE)) && $(MAKE) + $(Q)cd 3rd/libuv && ./autogen.sh && ./configure --host=$(HOST) LDFLAGS= && $(MAKE) libuv: 3rd/libuv/Makefile @@ -80,7 +82,7 @@ libuv: 3rd/libuv/Makefile $(Q)git submodule update --init 3rd/libsodium/Makefile: | 3rd/libsodium/autogen.sh - $(Q)cd 3rd/libsodium && ./autogen.sh && ./configure --host=$(patsubst %-,%,$(CROSS_COMPILE)) && $(MAKE) + $(Q)cd 3rd/libsodium && ./autogen.sh && ./configure --host=$(HOST) LDFLAGS= && $(MAKE) libsodium: 3rd/libsodium/Makefile @@ -88,7 +90,7 @@ libsodium: 3rd/libsodium/Makefile $(Q)git submodule update --init 3rd/c-ares/Makefile: | 3rd/c-ares/configure - $(Q)cd 3rd/c-ares && ./buildconf && ./configure --host=$(patsubst %-,%,$(CROSS_COMPILE)) && $(MAKE) + $(Q)cd 3rd/c-ares && ./buildconf && ./configure --host=$(HOST) LDFLAGS= && $(MAKE) MAKEFLAGS=-rRs c-ares: 3rd/c-ares/Makefile @@ -178,9 +180,13 @@ distclean: clean $(Q)cd 3rd/libuv && make distclean $(Q)cd 3rd/c-ares && make distclean +ifndef CROSS_COMPILE +install: + $(Q)cp xsocksd $(INSTALL_DIR) + $(Q)cp xsocks $(INSTALL_DIR) + $(Q)cp xtproxy $(INSTALL_DIR) + $(Q)cp xforwarder $(INSTALL_DIR) + $(Q)cp xtunnel $(INSTALL_DIR) +else install: - $(Q)cp xsocksd /usr/local/bin - $(Q)cp xsocks /usr/local/bin - $(Q)cp xtproxy /usr/local/bin - $(Q)cp xforwarder /usr/local/bin - $(Q)cp xtunnel /usr/local/bin +endif diff --git a/README.md b/README.md index 7a52947..704dce9 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ make && sudo make install # At OpenWRT build root cd package git clone https://github.com/xsocks/xsocks.git +cd .. # Build the package make package/xsocks/openwrt/compile diff --git a/openwrt/Makefile b/openwrt/Makefile index e08bb85..adf1132 100644 --- a/openwrt/Makefile +++ b/openwrt/Makefile @@ -2,17 +2,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xsocks PKG_VERSION:=0.1.0 -PKG_RELEASE=$(PKG_SOURCE_VERSION) +PKG_RELEASE=1 -PKG_SOURCE_URL:=https://github.com/lparam/xsocks/archive -PKG_SOURCE:=v$(PKG_VERSION).tar.gz -PKG_MAINTAINER:=Ken - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/lparam/xsocks.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_INSTALL:=1 -PKG_USE_MIPS16:=0 -PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=Ken include $(INCLUDE_DIR)/package.mk @@ -29,14 +30,14 @@ define Package/xsocks endef define Package/xsocks/description -xsocks is a secure and fast proxy for protect your network traffic + xsocks is a secure and fast proxy for protect your network traffic endef define Package/xsocks/install $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/xsocks.init $(1)/etc/init.d/xsocks $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/x{socks,tproxy,forwarder,tunnel} $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/x{socks,tproxy,forwarder,tunnel} $(1)/usr/bin endef $(eval $(call BuildPackage,xsocks)) diff --git a/openwrt/files/xsocks.init b/openwrt/files/xsocks.init index c4dcb5f..320a5e9 100644 --- a/openwrt/files/xsocks.init +++ b/openwrt/files/xsocks.init @@ -4,12 +4,12 @@ START=72 STOP=30 FIREWALL_RELOAD=0 -SERVER=server:port -PASSWORD=password +SERVER=IP:PORT +PASSWORD=PASSWORD start() { - xsocks -l 0.0.0.0:1080 -s $SERVER -k $PASSWORD -n -V - xtproxy -l 0.0.0.0:1070 -s $SERVER -k $PASSWORD -n -V + xsocks -s $SERVER -k $PASSWORD -n -V + xtproxy -s $SERVER -k $PASSWORD -n -V xforwarder -l localhost:5533 -t 8.8.8.8:53 -s $SERVER -k $PASSWORD -n -V } diff --git a/src/common.h b/src/common.h index 807c7ef..145591f 100644 --- a/src/common.h +++ b/src/common.h @@ -3,7 +3,7 @@ #include "uv.h" -#define XSOCKS_VERSION "0.1.0" +#define XSOCKS_VERSION "0.1.1" struct server_context { int index;