41 lines
805 B
Go
41 lines
805 B
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
nftupdatepkg "selective-vpn-api/app/nftupdate"
|
|
)
|
|
|
|
func nftLog(format string, args ...any) {
|
|
appendTraceLine("routes", fmt.Sprintf(format, args...))
|
|
}
|
|
|
|
func nftUpdateIPsSmart(ctx context.Context, ips []string, progressCb ProgressCallback) error {
|
|
return nftupdatepkg.UpdateIPsSmart(
|
|
ctx,
|
|
ips,
|
|
func(percent int, message string) {
|
|
if progressCb != nil {
|
|
progressCb(percent, message)
|
|
}
|
|
},
|
|
runCommandTimeout,
|
|
nftLog,
|
|
)
|
|
}
|
|
|
|
func nftUpdateSetIPsSmart(ctx context.Context, setName string, ips []string, progressCb ProgressCallback) error {
|
|
return nftupdatepkg.UpdateSetIPsSmart(
|
|
ctx,
|
|
setName,
|
|
ips,
|
|
func(percent int, message string) {
|
|
if progressCb != nil {
|
|
progressCb(percent, message)
|
|
}
|
|
},
|
|
runCommandTimeout,
|
|
nftLog,
|
|
)
|
|
}
|