├── LICENSE ├── Makefile ├── README-Chinese.md ├── README.md ├── doc └── openwrt ├── luasrc ├── controller │ └── socatg.lua └── model │ └── cbi │ └── socatg.lua └── root └── etc ├── config └── socatg ├── init.d └── socatg └── uci-defaults └── luci-socatg /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 drophair 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=luci-app-socatg 4 | PKG_VERSION=1.2 5 | PKG_RELEASE:=1 6 | PKG_LICENSE:=MIT 7 | PKG_MAINTAINER:=drophair 8 | LUCI_TITLE:=LuCI Support for socatg 9 | LUCI_PKGARCH:=all 10 | LUCI_DEPENDS:=+socat 11 | # PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) 12 | 13 | include $(INCLUDE_DIR)/package.mk 14 | include $(TOPDIR)/feeds/luci/luci.mk 15 | -------------------------------------------------------------------------------- /README-Chinese.md: -------------------------------------------------------------------------------- 1 | # luci-app-socatg 2 | 3 | **SocatG** 4 | Socat GUI,Socat可视化插件,支持所有架构,需要提前安装`socat`: 5 | ```Bash opkg install socat``` 6 | - 插件位置:网络->SocatG 7 | - 使用教程(正在审核):[什么值得买](https://post.smzdm.com/p/anxr0w00/) 8 | - 安装: 9 | 已向lean提交合并申请(待合并),[GitHub Releases](https://github.com/big-tooth/luci-app-socatg/releases) 中有预编译的 ipk 文件,安装命令: 10 | ```bash 11 | wget -P /tmp https://github.com/big-tooth/luci-app-socatg/releases/download/v1.1/luci-app-socatg_1.1-1_all.ipk 12 | opkg install /tmp/luci-app-socatg_1.1-1_all.ipk 13 | ``` 14 | ![OpenWrt 配置界面](./doc/openwrt) 15 | 16 | *** 17 | 感谢 18 | [Beginner-Go](https://github.com/Beginner-Go) 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # luci-app-socatg [中文文档](./README-Chinese.md) 2 | 3 | **SocatG** (Socat GUI),about IPv6 port forwarding IPv4,SocatG supports all architectures(x86,Arm,MIPS),SocatG needs the support of `socat`👇 4 | ```opkg install socat``` 5 | - Localtion:Network->SocatG 6 | - How to use(reviewing):[smzdm/什么值得买](https://post.smzdm.com/p/anxr0w00/) 7 | - Install: 8 | 1.We already commit a Pull Request to lean(Wait Merge) 9 | 2.[GitHub Releases](https://github.com/big-tooth/luci-app-socatg/releases) has uploaded precompiled file with ipk suffix,Command: 10 | ```bash 11 | wget -P /tmp https://github.com/big-tooth/luci-app-socatg/releases/download/v1.1/luci-app-socatg_1.1-1_all.ipk 12 | opkg install /tmp/luci-app-socatg_1.1-1_all.ipk 13 | ``` 14 | ![OpenWrt Configuration interface](./doc/openwrt) 15 | 16 | *** 17 | Thanks 18 | [Beginner-Go](https://github.com/Beginner-Go) 19 | -------------------------------------------------------------------------------- /doc/openwrt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/big-tooth/luci-app-socatg/6e17e5aff21dbbbafd1c2db9d0ee5ff67e76ed80/doc/openwrt -------------------------------------------------------------------------------- /luasrc/controller/socatg.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.socatg", package.seeall) 2 | 3 | function index() 4 | if not nixio.fs.access("/etc/config/socatg") then 5 | return 6 | end 7 | 8 | entry({"admin", "network", "socatg"}, cbi("socatg"), _("SocatG"), 100).dependent = true 9 | end 10 | -------------------------------------------------------------------------------- /luasrc/model/cbi/socatg.lua: -------------------------------------------------------------------------------- 1 | m = Map("socatg") 2 | m.title = translate("IPv6 端口转发") 3 | m.description = translate(' GitHub 项目地址 ') 4 | 5 | s = m:section(TypedSection, "socatg") 6 | s.addremove = false 7 | s.anonymous = true 8 | 9 | v6port = s:option(Value, "v6port", translate("v6port")) 10 | v4host = s:option(Value, "v4host", translate("v4host")) 11 | v4port = s:option(Value, "v4port", translate("v4port")) 12 | 13 | local apply = luci.http.formvalue("cbi.apply") 14 | if apply then 15 | io.popen("/etc/init.d/socatg restart") 16 | end 17 | 18 | return m 19 | -------------------------------------------------------------------------------- /root/etc/config/socatg: -------------------------------------------------------------------------------- 1 | config socatg 2 | option v6port '' 3 | option v4host '' 4 | option v4port '' 5 | -------------------------------------------------------------------------------- /root/etc/init.d/socatg: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | START=50 3 | 4 | run_socatg() 5 | { 6 | local v6port 7 | local v4host 8 | local v4port 9 | 10 | config_get v6port $1 v6port 11 | config_get v4host $1 v4host 12 | config_get v4port $1 v4port 13 | 14 | socat TCP6-LISTEN:$v6port,reuseaddr,fork TCP4:$v4host:$v4port & 15 | 16 | echo "run_socatg has started." 17 | } 18 | 19 | start() 20 | { 21 | config_load socatg 22 | config_foreach run_socatg socatg 23 | } 24 | 25 | stop() 26 | { 27 | # killall njit-client 28 | # killall udhcpc 29 | 30 | echo "SocatG Client has stoped." 31 | } 32 | -------------------------------------------------------------------------------- /root/etc/uci-defaults/luci-socatg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | uci -q batch <<-EOF >/dev/null 4 | delete ucitrack.@socatg[-1] 5 | add ucitrack socatg 6 | set ucitrack.@socatg[-1].init=socatg 7 | commit ucitrack 8 | EOF 9 | 10 | rm -f /tmp/luci-indexcache 11 | exit 0 12 | --------------------------------------------------------------------------------