-
Notifications
You must be signed in to change notification settings - Fork 3.9k
swgp-go: add at 1.10.0 #29889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
swgp-go: add at 1.10.0 #29889
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # | ||
| # Copyright (C) 2026 Florian Klink | ||
| # | ||
| # This is free software, licensed under the GNU General Public License v2. | ||
| # See /LICENSE for more information. | ||
| # | ||
|
|
||
| include $(TOPDIR)/rules.mk | ||
|
|
||
| PKG_NAME:=swgp-go | ||
| PKG_VERSION:=1.10.0 | ||
| PKG_RELEASE:=1 | ||
|
|
||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||
| PKG_SOURCE_URL:=https://codeload.github.com/database64128/swgp-go/tar.gz/v$(PKG_VERSION)? | ||
| PKG_HASH:=0d7e5ebce9c07237e71028eac31b27c51d155c5a72eefc7bceac4cc816725d23 | ||
|
|
||
| PKG_MAINTAINER:=Florian Klink <flokli@flokli.de> | ||
| PKG_LICENSE:=AGPL-3.0-or-later | ||
| PKG_LICENSE_FILES:=LICENSE | ||
|
|
||
| PKG_BUILD_DEPENDS:=golang/host | ||
| PKG_BUILD_PARALLEL:=1 | ||
| PKG_BUILD_FLAGS:=no-mips16 | ||
|
|
||
| GO_PKG:=github.com/database64128/swgp-go | ||
| GO_PKG_TAGS:=swgpgo_nopprof | ||
|
|
||
| include $(INCLUDE_DIR)/package.mk | ||
| include ../../lang/golang/golang-package.mk | ||
|
|
||
| define Package/swgp-go | ||
| SECTION:=net | ||
| CATEGORY:=Network | ||
| TITLE:=Simple WireGuard proxy | ||
| URL:=https://github.com/database64128/swgp-go | ||
| DEPENDS:=$(GO_ARCH_DEPENDS) | ||
| endef | ||
|
|
||
| define Package/swgp-go/description | ||
| Simple WireGuard proxy with minimal overhead for WireGuard traffic. | ||
| endef | ||
|
|
||
| define Package/swgp-go/conffiles | ||
| /etc/swgp-go.json | ||
| endef | ||
|
|
||
| define Package/swgp-go/install | ||
| $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d | ||
| $(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/swgp-go $(1)/usr/sbin | ||
| $(INSTALL_BIN) ./files/swgp-go.init $(1)/etc/init.d/swgp-go | ||
| $(INSTALL_DATA) ./files/swgp-go.json $(1)/etc/swgp-go.json | ||
| endef | ||
|
|
||
| $(eval $(call BuildPackage,swgp-go)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # swgp-go | ||
| This readme should help you configure swgp-go. | ||
|
|
||
| ## Configuration | ||
| Edit `/etc/swgp-go.json` with your desired configuration (Client, Server or both). | ||
|
|
||
| If you're configuring a server, also properly allow that port in your firewall. | ||
|
|
||
| Note the pprof feature is disabled in this package. If you try to enable it | ||
| regardless, `swgp-go` will show an error on startup. | ||
|
|
||
| ## Start daemon | ||
| Once you have created your config, enable and run swgp-go using its init script: | ||
|
|
||
| ``` | ||
| /etc/init.d/swgp-go enable | ||
| /etc/init.d/swgp-go start | ||
| ``` | ||
|
|
||
| Please refer to the [Project README](https://github.com/database64128/swgp-go) for more configuration info and examples. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/sh /etc/rc.common | ||
| # | ||
| # SPDX-License-Identifier: GPL-2.0-only | ||
|
|
||
| USE_PROCD=1 | ||
| START=90 | ||
|
|
||
| SWGP_GO_BIN="/usr/sbin/swgp-go" | ||
| SWGP_GO_CONF="/etc/swgp-go.json" | ||
|
|
||
| start_service() { | ||
| procd_open_instance | ||
| procd_set_param command $SWGP_GO_BIN -confPath $SWGP_GO_CONF -logLevel DEBUG | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The log level is hard-coded to Generated by Claude Code
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't log for each packet, but logs two more lines once a new session is established. There isn't any uci config integration so far, and logging for sessions is also something dropbear does, so I'd say it's ok to keep it that way for now. |
||
| procd_set_param file "$SWGP_GO_CONF" | ||
| procd_set_param stdout 1 | ||
| procd_set_param stderr 1 | ||
| procd_set_param respawn | ||
| procd_close_instance | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "servers": [], | ||
| "clients": [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/sh | ||
|
|
||
| swgp-go -version 2>&1 | ||
| swgp-go -version 2>&1 | grep "$2" | ||
| [ $? == 0 ] || { | ||
| echo "Problem or incorrect version for '$1'" | ||
| exit 1 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this readme? :-) How to start daemon it is quite obvious how OpenWrt works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upstream doesn't have a canonical config file location, and as it requires some configuration on startup I wanted to write it down somewhere. And I saw some other packages also putting readme files like this in there. Is there a better location to put it, or you want me to remove it alltogether?