Compare commits

...

4 Commits

Author SHA1 Message Date
2371abc9fd destroy ipset
All checks were successful
Build and Package OPKG / Build for aarch64-3.10 (push) Successful in 53s
Build and Package OPKG / Build for armv5-3.2 (push) Successful in 44s
Build and Package OPKG / Build for armv7-2.6 (push) Successful in 42s
Build and Package OPKG / Build for armv7-3.2 (push) Successful in 41s
Build and Package OPKG / Build for mips-3.4 (push) Successful in 44s
Build and Package OPKG / Build for mipsel-3.4 (push) Successful in 43s
2025-02-14 01:24:52 +03:00
fb60f838bc change path 2025-02-14 01:16:18 +03:00
43a13664f2 change section 2025-02-14 01:15:37 +03:00
258fa0a275 service 2025-02-14 01:15:27 +03:00
4 changed files with 22 additions and 3 deletions

View File

@ -15,7 +15,7 @@ GOARM ?=
BUILD_DIR = ./.build
PKG_DIR = $(BUILD_DIR)/$(ARCH)
BIN_DIR = $(PKG_DIR)/data/opt/usr/bin
BIN_DIR = $(PKG_DIR)/data/opt/bin
PARAMS = -v -a -trimpath -ldflags="-X 'kvas2/constant.Version=$(VERSION)' -X 'kvas2/constant.Commit=$(COMMIT)' -w -s"
all: build_daemon package
@ -31,7 +31,7 @@ package:
@echo 'Architecture: $(ARCH)' >> $(PKG_DIR)/control/control
@echo 'Maintainer: $(APP_MAINTAINER)' >> $(PKG_DIR)/control/control
@echo 'Description: $(APP_DESCRIPTION)' >> $(PKG_DIR)/control/control
@echo 'Section: base' >> $(PKG_DIR)/control/control
@echo 'Section: net' >> $(PKG_DIR)/control/control
@echo 'Priority: optional' >> $(PKG_DIR)/control/control
@echo 'Depends: libc, iptables, socat' >> $(PKG_DIR)/control/control
@mkdir -p $(PKG_DIR)/data/opt/usr/bin

View File

@ -86,6 +86,15 @@ func (g *Group) Disable() []error {
return errs
}
func (g *Group) Destroy() []error {
errs := g.Disable()
err := g.ipset.Destroy()
if err != nil {
errs = append(errs, err)
}
return errs
}
func (g *Group) Sync(records *records.Records) error {
now := time.Now()

View File

@ -164,7 +164,7 @@ func (a *App) start(ctx context.Context) (err error) {
}
defer func() {
for _, group := range a.Groups {
_ = group.Disable()
_ = group.Destroy()
}
}()

10
opt/etc/init.d/S99kvas2 Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
ENABLED=yes
PROCS=kvas2d
ARGS=""
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
. /opt/etc/init.d/rc.func