new: add makefile for open wrt
This commit is contained in:
@@ -2,8 +2,12 @@
|
|||||||
# Attribution-NonCommercial-ShareAlike 4.0 International
|
# Attribution-NonCommercial-ShareAlike 4.0 International
|
||||||
|
|
||||||
## Summary:
|
## Summary:
|
||||||
|
- The forks of the app are not allowed to be listed on F-Droid or other app stores under the original name or original design.
|
||||||
|
- Any forks should be published open-source under the same license.
|
||||||
|
- Prior consent is required to publish a fork or utilize any part of this repository (github.com/hiddify/hiddify-next and github.com/hiddify/hiddify-next-core) in an application intended for publication on the App Store or for iOS/macOS platforms. (We reserve the right to modify this requirement in the future after completing development for iOS and macOS).
|
||||||
|
- You need prior consent to publish a fork or use any part of this code in an application published in AppStore or publish for iOS or macOS. (We reserve the right to modify this requirement in the future after completing development for iOS and macOS).
|
||||||
- You are free to:
|
- You are free to:
|
||||||
- Share — copy and redistribute the material in any medium or format
|
- Share — copy and redistribute the material in any medium or format with
|
||||||
- Adapt — remix, transform, and build upon the material
|
- Adapt — remix, transform, and build upon the material
|
||||||
- Under the following terms:
|
- Under the following terms:
|
||||||
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
||||||
@@ -12,6 +16,8 @@
|
|||||||
|
|
||||||
- ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
|
- ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
|
||||||
|
|
||||||
|
- Prior consent is required before utilizing any portion of this code for integration into an application intended for the App Store.
|
||||||
|
|
||||||
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
|
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
|
||||||
|
|
||||||
### Using Creative Commons Public Licenses
|
### Using Creative Commons Public Licenses
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -14,7 +14,7 @@ endif
|
|||||||
TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc
|
TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc
|
||||||
IOS_ADD_TAGS=with_dhcp,with_low_memory,with_conntrack
|
IOS_ADD_TAGS=with_dhcp,with_low_memory,with_conntrack
|
||||||
GOBUILDLIB=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
|
GOBUILDLIB=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
|
||||||
GOBUILDSRV=CGO_ENABLED=1 go build -trimpath -tags $(TAGS)
|
GOBUILDSRV=CGO_ENABLED=1 go build -ldflags "-s gc-w" -trimpath -tags $(TAGS)
|
||||||
|
|
||||||
.PHONY: protos
|
.PHONY: protos
|
||||||
protos:
|
protos:
|
||||||
@@ -74,7 +74,7 @@ linux-amd64:
|
|||||||
linux-custom:
|
linux-custom:
|
||||||
mkdir -p $(BINDIR)/
|
mkdir -p $(BINDIR)/
|
||||||
#env GOARCH=mips $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/
|
#env GOARCH=mips $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME) ./cli/
|
||||||
go build -trimpath -tags $(TAGS) -o $(BINDIR)/$(CLINAME) ./cli/
|
go build -ldflags "-w" -trimpath -tags $(TAGS) -o $(BINDIR)/$(CLINAME) ./cli/
|
||||||
chmod +x $(BINDIR)/$(CLINAME)
|
chmod +x $(BINDIR)/$(CLINAME)
|
||||||
make webui
|
make webui
|
||||||
|
|
||||||
|
|||||||
63
wrt/Makefile
Normal file
63
wrt/Makefile
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=hiddify-core
|
||||||
|
PKG_VERSION:=1.2.0
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_SOURCE_URL:=https://codeload.github.com/hiddify/hiddify-core/tar.gz/v$(PKG_VERSION)?
|
||||||
|
PKG_HASH:=481098a29b0b08d225598e5e74eddfe4cbdd4560b7ac74d210dcc923792a3e24
|
||||||
|
|
||||||
|
PKG_LICENSE:=https://github.com/hiddify/hiddify-next/edit/main/LICENSE.md
|
||||||
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
PKG_MAINTAINER:=Hiddify <wrt@hiddify.com>
|
||||||
|
|
||||||
|
PKG_BUILD_DEPENDS:=golang/host
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
PKG_BUILD_FLAGS:=no-mips16
|
||||||
|
|
||||||
|
GO_PKG:=github.com/hiddify/hiddify-core
|
||||||
|
GO_PKG_BUILD_PKG:=$(GO_PKG)/cli
|
||||||
|
|
||||||
|
GO_PKG_LDFLAGS_X:=$(GO_PKG)/constant.Version=$(PKG_VERSION)
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include ../../lang/golang/golang-package.mk
|
||||||
|
|
||||||
|
define Package/hiddify-core
|
||||||
|
TITLE:=Hiddify universal proxy platform
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
URL:=https://hiddify.com/
|
||||||
|
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle +kmod-inet-diag +kmod-tun
|
||||||
|
USERID:=hiddify-core=5566:hiddify-core=5566
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/hiddify-core/description
|
||||||
|
Hiddify is a universal proxy platform which supports hysteria, SOCKS, Shadowsocks,
|
||||||
|
ShadowTLS, Tor, trojan, VLess, VMess, WireGuard and so on.
|
||||||
|
endef
|
||||||
|
|
||||||
|
GO_PKG_TAGS:=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc,with_low_memory,with_conntrack
|
||||||
|
|
||||||
|
define Package/hiddify-core/conffiles
|
||||||
|
/etc/config/hiddify-core
|
||||||
|
/etc/hiddify-core/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/hiddify-core/install
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/HiddifyCli $(1)/usr/bin/hiddify-cli
|
||||||
|
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/HiddifyCli $(1)/usr/bin/HiddifyCli
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/hiddify-core
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/release/config/config.json $(1)/etc/hiddify-core
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config/
|
||||||
|
$(INSTALL_CONF) ./files/hiddify.conf $(1)/etc/config/hiddify-core
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||||
|
$(INSTALL_BIN) ./files/hiddify.init $(1)/etc/init.d/hiddify-core
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,hiddify-core))
|
||||||
6
wrt/files/hiddify-core.conf
Normal file
6
wrt/files/hiddify-core.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
config hiddify-core 'main'
|
||||||
|
option enabled '0'
|
||||||
|
option user 'hiddify-core'
|
||||||
|
option conffile '/etc/hiddify-core/config.json'
|
||||||
|
option workdir '/usr/share/hiddify-core'
|
||||||
39
wrt/files/hiddify-core.init
Normal file
39
wrt/files/hiddify-core.init
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
|
START=99
|
||||||
|
|
||||||
|
NAME="hiddify-core"
|
||||||
|
PROG="/usr/bin/hiddify-core"
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
config_load "$NAME"
|
||||||
|
|
||||||
|
local enabled user group conffile workdir
|
||||||
|
config_get_bool enabled "main" "enabled" "0"
|
||||||
|
[ "$enabled" -eq "1" ] || return 0
|
||||||
|
|
||||||
|
config_get user "main" "user" "root"
|
||||||
|
config_get conffile "main" "conffile"
|
||||||
|
config_get workdir "main" "workdir" "/usr/share/hiddify-core"
|
||||||
|
|
||||||
|
mkdir -p "$workdir"
|
||||||
|
local group="$(id -ng $user)"
|
||||||
|
chown $user:$group "$workdir"
|
||||||
|
|
||||||
|
procd_open_instance "$NAME.main"
|
||||||
|
procd_set_param command "$PROG" run -c "$conffile" -D "$workdir"
|
||||||
|
|
||||||
|
# Use root user if you want to use the TUN mode.
|
||||||
|
procd_set_param user "$user"
|
||||||
|
procd_set_param file "$conffile"
|
||||||
|
procd_set_param stdout 1
|
||||||
|
procd_set_param stderr 1
|
||||||
|
procd_set_param respawn
|
||||||
|
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "$NAME"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user