diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6d8e4a..6e38a0c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: name: Build ${{ matrix.arch }} on ${{ matrix.version }} runs-on: ubuntu-latest strategy: - fail-fast: false + fail-fast: true matrix: arch: - x86_64 @@ -56,7 +56,7 @@ jobs: name: Build ${{ matrix.goos }}/${{ matrix.goarch }} runs-on: ubuntu-latest strategy: - fail-fast: false + fail-fast: true matrix: include: - goos: linux diff --git a/openwrt/Makefile b/openwrt/Makefile index d46efd1..465d0a0 100644 --- a/openwrt/Makefile +++ b/openwrt/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=UA3F -PKG_VERSION:=1.8.5 +PKG_VERSION:=1.8.6 PKG_RELEASE:=1 # PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/openwrt/files/luci/model/cbi/ua3f.lua b/openwrt/files/luci/model/cbi/ua3f.lua index bfce464..7b63da5 100644 --- a/openwrt/files/luci/model/cbi/ua3f.lua +++ b/openwrt/files/luci/model/cbi/ua3f.lua @@ -6,7 +6,7 @@ local NamedSection = cbi.NamedSection local ua3f = cbi.Map("ua3f", "UA3F", [[ - Version: 1.8.5 + Version: 1.8.6
Across the Campus we can reach every corner in the world. ]] diff --git a/scripts/build.sh b/scripts/build.sh index 2d972c4..85acf44 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -8,7 +8,7 @@ set -e project_name="ua3f" -release_version="1.8.5" +release_version="1.8.6" target=main.go LINUX_ARCHS="amd64 arm arm64 mipsle mips64 riscv64 386 mipsle-softfloat mipsle-hardfloat armv7 armv8" diff --git a/scripts/ipkg/CONTROL/control b/scripts/ipkg/CONTROL/control index af28459..b5e388e 100644 --- a/scripts/ipkg/CONTROL/control +++ b/scripts/ipkg/CONTROL/control @@ -1,5 +1,5 @@ Package: ua3f -Version: 1.8.5-1 +Version: 1.8.6-1 Depends: luci-compat, ipset, iptables, iptables-mod-tproxy, iptables-mod-extra, iptables-mod-nat-extra, kmod-ipt-conntrack, iptables-mod-ipopt, iptables-mod-nfqueue, iptables-mod-conntrack-extra, kmod-nf-conntrack-netlink Source: /feed/openwrt SourceName: UA3F diff --git a/scripts/ipkg/CONTROL/control-e b/scripts/ipkg/CONTROL/control-e index af28459..b5e388e 100644 --- a/scripts/ipkg/CONTROL/control-e +++ b/scripts/ipkg/CONTROL/control-e @@ -1,5 +1,5 @@ Package: ua3f -Version: 1.8.5-1 +Version: 1.8.6-1 Depends: luci-compat, ipset, iptables, iptables-mod-tproxy, iptables-mod-extra, iptables-mod-nat-extra, kmod-ipt-conntrack, iptables-mod-ipopt, iptables-mod-nfqueue, iptables-mod-conntrack-extra, kmod-nf-conntrack-netlink Source: /feed/openwrt SourceName: UA3F diff --git a/src/internal/log/log.go b/src/internal/log/log.go index 18808c7..fa5a9c0 100644 --- a/src/internal/log/log.go +++ b/src/internal/log/log.go @@ -4,12 +4,10 @@ import ( "io" "log/slog" "os" - "runtime" "strings" "time" "github.com/sunbk201/ua3f/internal/config" - "golang.org/x/sys/unix" "gopkg.in/natefinch/lumberjack.v2" ) @@ -100,51 +98,6 @@ func LoadLocalLocation() *time.Location { return time.UTC } -func GetOSInfo() (attrs []any) { - - attrs = append(attrs, - slog.String("GOOS", runtime.GOOS), - slog.String("GOARCH", runtime.GOARCH), - slog.String("Go Version", runtime.Version()), - ) - - if hostname, err := os.Hostname(); err == nil { - attrs = append(attrs, slog.String("hostname", hostname)) - } - - switch runtime.GOOS { - case "linux", "darwin", "freebsd", "openbsd", "netbsd": - var uname unix.Utsname - if err := unix.Uname(&uname); err == nil { - toStr := func(b []byte) string { - n := 0 - for ; n < len(b); n++ { - if b[n] == 0 { - break - } - } - return strings.TrimSpace(string(b[:n])) - } - attrs = append(attrs, - slog.String("sysname", toStr(uname.Sysname[:])), - slog.String("nodename", toStr(uname.Nodename[:])), - slog.String("release", toStr(uname.Release[:])), - slog.String("version", toStr(uname.Version[:])), - slog.String("machine", toStr(uname.Machine[:])), - ) - } - case "windows": - osver := "unknown" - if v, ok := os.LookupEnv("OS"); ok { - osver = v - } - attrs = append(attrs, slog.String("os_version", osver)) - default: - attrs = append(attrs, slog.String("info", "unknown OS details")) - } - return attrs -} - func trim(s string) string { for len(s) > 0 && (s[len(s)-1] == '\n' || s[len(s)-1] == '\r' || s[len(s)-1] == ' ') { s = s[:len(s)-1] diff --git a/src/internal/log/os_others.go b/src/internal/log/os_others.go new file mode 100644 index 0000000..82f2dac --- /dev/null +++ b/src/internal/log/os_others.go @@ -0,0 +1,34 @@ +//go:build !unix + +package log + +import ( + "log/slog" + "os" + "runtime" +) + +func GetOSInfo() (attrs []any) { + + attrs = append(attrs, + slog.String("GOOS", runtime.GOOS), + slog.String("GOARCH", runtime.GOARCH), + slog.String("Go Version", runtime.Version()), + ) + + if hostname, err := os.Hostname(); err == nil { + attrs = append(attrs, slog.String("hostname", hostname)) + } + + switch runtime.GOOS { + case "windows": + osver := "unknown" + if v, ok := os.LookupEnv("OS"); ok { + osver = v + } + attrs = append(attrs, slog.String("os_version", osver)) + default: + attrs = append(attrs, slog.String("info", "unknown OS details")) + } + return attrs +} diff --git a/src/internal/log/os_unix.go b/src/internal/log/os_unix.go new file mode 100644 index 0000000..50044c9 --- /dev/null +++ b/src/internal/log/os_unix.go @@ -0,0 +1,51 @@ +//go:build unix + +package log + +import ( + "log/slog" + "os" + "runtime" + "strings" + + "golang.org/x/sys/unix" +) + +func GetOSInfo() (attrs []any) { + + attrs = append(attrs, + slog.String("GOOS", runtime.GOOS), + slog.String("GOARCH", runtime.GOARCH), + slog.String("Go Version", runtime.Version()), + ) + + if hostname, err := os.Hostname(); err == nil { + attrs = append(attrs, slog.String("hostname", hostname)) + } + + switch runtime.GOOS { + case "linux", "darwin", "freebsd", "openbsd", "netbsd": + var uname unix.Utsname + if err := unix.Uname(&uname); err == nil { + toStr := func(b []byte) string { + n := 0 + for ; n < len(b); n++ { + if b[n] == 0 { + break + } + } + return strings.TrimSpace(string(b[:n])) + } + attrs = append(attrs, + slog.String("sysname", toStr(uname.Sysname[:])), + slog.String("nodename", toStr(uname.Nodename[:])), + slog.String("release", toStr(uname.Release[:])), + slog.String("version", toStr(uname.Version[:])), + slog.String("machine", toStr(uname.Machine[:])), + ) + } + default: + attrs = append(attrs, slog.String("info", "unknown OS details")) + } + return attrs +} diff --git a/src/main.go b/src/main.go index aa4dd2c..8b04377 100644 --- a/src/main.go +++ b/src/main.go @@ -16,7 +16,7 @@ import ( "github.com/sunbk201/ua3f/internal/statistics" ) -const version = "1.8.5" +const version = "1.8.6" func main() { cfg, showVer := config.Parse()