Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Apr 9, 2024
1 parent 0e2f582 commit 9744514
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 133 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
with:
distribution: goreleaser-pro
version: latest
args: goreleaser release -f .goreleaser.fury.yaml --clean
args: release -f .goreleaser.fury.yaml --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
12 changes: 6 additions & 6 deletions .goreleaser.fury.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ nfpms:
dst: /etc/sing-box/config.json
type: config
- src: release/config/sing-box.service
dst: /etc/systemd/system/sing-box.service
dst: /usr/lib/systemd/system/sing-box.service
- src: release/config/[email protected]
dst: /etc/systemd/system/[email protected]
dst: /usr/lib/systemd/system/[email protected]
- src: LICENSE
dst: /usr/share/licenses/sing-box/LICENSE
conflicts:
- sing-box-beta
- id: package_beta
<<: *template
package_name: sing-box-beta
file_name_template: '{{ .ProjectName }}-beta_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
formats:
- deb
- rpm
Expand All @@ -71,10 +72,9 @@ furies:
- account: sagernet
ids:
- package
skip: |-
{{ eq .Prerelease "" }}
skip: "{{ .Prerelease }}"
- account: sagernet
ids:
- package_beta
skip: |-
{{ ne .Prerelease "" }}
skip: "{{ not .Prerelease }}"

8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ builds:
- with_clash_api
env:
- CGO_ENABLED=0
- GOROOT=/nix/store/cpfvjwc7d5hai3iar78h86iwnvgppjrg-go-1.20.14/share/go
gobinary: /nix/store/cpfvjwc7d5hai3iar78h86iwnvgppjrg-go-1.20.14/bin/go
- GOROOT={{ .Env.GOPATH }}/go1.20.14
gobinary: "{{ .Env.GOPATH }}/go1.20.14/bin/go"
targets:
- windows_amd64_v1
- windows_386
Expand Down Expand Up @@ -128,9 +128,9 @@ nfpms:
dst: /etc/sing-box/config.json
type: config
- src: release/config/sing-box.service
dst: /etc/systemd/system/sing-box.service
dst: /usr/lib/systemd/system/sing-box.service
- src: release/config/[email protected]
dst: /etc/systemd/system/[email protected]
dst: /usr/lib/systemd/system/[email protected]
- src: LICENSE
dst: /usr/share/licenses/sing-box/LICENSE
deb:
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ proto_install:
go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

release:
go run ./cmd/internal/build goreleaser release --clean --skip publish --skip fury
go run ./cmd/internal/build goreleaser release --clean --skip publish
mkdir dist/release
mv dist/*.tar.gz \
dist/*.zip \
Expand All @@ -81,14 +81,13 @@ release_repo:
go run ./cmd/internal/build goreleaser release -f .goreleaser.fury.yaml --clean

release_install:
go install -v github.com/goreleaser/goreleaser@latest
go install -v github.com/tcnksm/ghr@latest

update_android_version:
go run ./cmd/internal/update_android_version

build_android:
cd ../sing-box-for-android && ./gradlew :app:assemblePlayRelease && ./gradlew :app:assembleOtherRelease && ./gradlew --stop
cd ../sing-box-for-android && ./gradlew :app:clean :app:assemblePlayRelease :app:assembleOtherRelease && ./gradlew --stop

upload_android:
mkdir -p dist/release_android
Expand Down
4 changes: 2 additions & 2 deletions box.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (s *Box) Start() error {
}

func (s *Box) preStart() error {
monitor := taskmonitor.New(s.logger, C.DefaultStartTimeout)
monitor := taskmonitor.New(s.logger, C.StartTimeout)
monitor.Start("start logger")
err := s.logFactory.Start()
monitor.Finish()
Expand Down Expand Up @@ -343,7 +343,7 @@ func (s *Box) Close() error {
default:
close(s.done)
}
monitor := taskmonitor.New(s.logger, C.DefaultStopTimeout)
monitor := taskmonitor.New(s.logger, C.StopTimeout)
var errors error
for serviceName, service := range s.postServices {
monitor.Start("close ", serviceName)
Expand Down
2 changes: 1 addition & 1 deletion box_outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func (s *Box) startOutbounds() error {
monitor := taskmonitor.New(s.logger, C.DefaultStartTimeout)
monitor := taskmonitor.New(s.logger, C.StartTimeout)
outboundTags := make(map[adapter.Outbound]string)
outbounds := make(map[string]adapter.Outbound)
for i, outboundToStart := range s.outbounds {
Expand Down
2 changes: 1 addition & 1 deletion clients/android
Submodule android updated 51 files
+5 −0 app/build.gradle
+10 −0 app/src/main/AndroidManifest.xml
+1 −0 app/src/main/java/io/nekohasekai/sfa/Application.kt
+2 −2 app/src/main/java/io/nekohasekai/sfa/bg/AppChangeReceiver.kt
+2 −0 app/src/main/java/io/nekohasekai/sfa/bg/BootReceiver.kt
+9 −5 app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt
+3 −0 app/src/main/java/io/nekohasekai/sfa/bg/DefaultNetworkListener.kt
+1 −0 app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt
+2 −2 app/src/main/java/io/nekohasekai/sfa/bg/ProxyService.kt
+2 −0 app/src/main/java/io/nekohasekai/sfa/bg/ServiceBinder.kt
+2 −0 app/src/main/java/io/nekohasekai/sfa/bg/ServiceNotification.kt
+2 −2 app/src/main/java/io/nekohasekai/sfa/bg/VPNService.kt
+2 −0 app/src/main/java/io/nekohasekai/sfa/database/ProfileManager.kt
+2 −0 app/src/main/java/io/nekohasekai/sfa/database/Settings.kt
+1 −1 app/src/main/java/io/nekohasekai/sfa/ktx/Shares.kt
+2 −2 app/src/main/java/io/nekohasekai/sfa/ui/MainActivity.kt
+33 −0 app/src/main/java/io/nekohasekai/sfa/ui/dashboard/Groups.kt
+20 −21 app/src/main/java/io/nekohasekai/sfa/ui/dashboard/GroupsFragment.kt
+2 −0 app/src/main/java/io/nekohasekai/sfa/ui/dashboard/OverviewFragment.kt
+0 −1 app/src/main/java/io/nekohasekai/sfa/ui/debug/VPNScanActivity.kt
+48 −4 app/src/main/java/io/nekohasekai/sfa/ui/main/ConfigurationFragment.kt
+4 −4 app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt
+19 −17 app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt
+1 −4 app/src/main/java/io/nekohasekai/sfa/ui/profile/EditProfileActivity.kt
+0 −2 app/src/main/java/io/nekohasekai/sfa/ui/profile/EditProfileContentActivity.kt
+1 −5 app/src/main/java/io/nekohasekai/sfa/ui/profile/NewProfileActivity.kt
+216 −0 app/src/main/java/io/nekohasekai/sfa/ui/profile/QRScanActivity.kt
+49 −0 app/src/main/java/io/nekohasekai/sfa/ui/profile/ZxingQRCodeAnalyzer.kt
+42 −27 app/src/main/java/io/nekohasekai/sfa/ui/profileoverride/PerAppProxyActivity.kt
+5 −0 app/src/main/java/io/nekohasekai/sfa/vendor/VendorInterface.kt
+12 −0 app/src/main/res/drawable/ic_baseline_create_new_folder_24.xml
+12 −0 app/src/main/res/drawable/ic_baseline_file_open_24.xml
+1 −0 app/src/main/res/layout/activity_edit_profile.xml
+26 −0 app/src/main/res/layout/activity_qr_scan.xml
+2 −2 app/src/main/res/layout/activity_vpn_scan.xml
+1 −0 app/src/main/res/layout/fragment_configuration.xml
+3 −0 app/src/main/res/layout/fragment_dashboard_groups.xml
+1 −0 app/src/main/res/layout/fragment_log.xml
+95 −0 app/src/main/res/layout/sheet_add_profile.xml
+2 −2 app/src/main/res/layout/view_dashboard_group.xml
+1 −0 app/src/main/res/layout/view_prefenence_screen.xml
+20 −0 app/src/main/res/menu/qr_scan_menu.xml
+1 −1 app/src/main/res/values-night/themes.xml
+9 −1 app/src/main/res/values/strings.xml
+9 −1 app/src/main/res/values/themes.xml
+7 −0 app/src/other/java/io/nekohasekai/sfa/vendor/Vendor.kt
+63 −0 app/src/play/java/io/nekohasekai/sfa/vendor/MLKitQRCodeAnalyzer.kt
+16 −0 app/src/play/java/io/nekohasekai/sfa/vendor/Vendor.kt
+2 −2 build.gradle
+2 −1 gradle/wrapper/gradle-wrapper.properties
+3 −3 version.properties
2 changes: 1 addition & 1 deletion cmd/sing-box/cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func run() error {
}

func closeMonitor(ctx context.Context) {
time.Sleep(C.DefaultStopFatalTimeout)
time.Sleep(C.FatalStopTimeout)
select {
case <-ctx.Done():
return
Expand Down
23 changes: 12 additions & 11 deletions constant/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ package constant
import "time"

const (
TCPTimeout = 5 * time.Second
ReadPayloadTimeout = 300 * time.Millisecond
DNSTimeout = 10 * time.Second
QUICTimeout = 30 * time.Second
STUNTimeout = 15 * time.Second
UDPTimeout = 5 * time.Minute
DefaultURLTestInterval = 3 * time.Minute
DefaultURLTestIdleTimeout = 30 * time.Minute
DefaultStartTimeout = 10 * time.Second
DefaultStopTimeout = 5 * time.Second
DefaultStopFatalTimeout = 10 * time.Second
TCPTimeout = 5 * time.Second
ReadPayloadTimeout = 300 * time.Millisecond
DNSTimeout = 10 * time.Second
QUICTimeout = 30 * time.Second
STUNTimeout = 15 * time.Second
UDPTimeout = 5 * time.Minute
DefaultURLTestInterval = 3 * time.Minute
DefaultURLTestIdleTimeout = 30 * time.Minute
StartTimeout = 10 * time.Second
StopTimeout = 5 * time.Second
FatalStopTimeout = 10 * time.Second
FakeIPMetadataSaveInterval = 10 * time.Second
)
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
icon: material/alert-decagram
---

#### 1.8.11

* Fixes and improvements

#### 1.8.10

* Fixes and improvements

#### 1.8.9

* Fixes and improvements
Expand Down
12 changes: 7 additions & 5 deletions experimental/cachefile/fakeip.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/sagernet/bbolt"
"github.com/sagernet/sing-box/adapter"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing/common/logger"
M "github.com/sagernet/sing/common/metadata"
)
Expand Down Expand Up @@ -58,12 +59,13 @@ func (c *CacheFile) FakeIPSaveMetadata(metadata *adapter.FakeIPMetadata) error {
}

func (c *CacheFile) FakeIPSaveMetadataAsync(metadata *adapter.FakeIPMetadata) {
if timer := c.saveMetadataTimer; timer != nil {
timer.Stop()
if c.saveMetadataTimer == nil {
c.saveMetadataTimer = time.AfterFunc(C.FakeIPMetadataSaveInterval, func() {
_ = c.FakeIPSaveMetadata(metadata)
})
} else {
c.saveMetadataTimer.Reset(C.FakeIPMetadataSaveInterval)
}
c.saveMetadataTimer = time.AfterFunc(10*time.Second, func() {
_ = c.FakeIPSaveMetadata(metadata)
})
}

func (c *CacheFile) FakeIPStore(address netip.Addr, domain string) error {
Expand Down
2 changes: 1 addition & 1 deletion experimental/libbox/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *BoxService) Close() error {
select {
case <-done:
return
case <-time.After(C.DefaultStopFatalTimeout):
case <-time.After(C.FatalStopTimeout):
os.Exit(1)
}
}()
Expand Down
30 changes: 14 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/imkira/go-observer/v2 v2.0.0-20230629064422-8e0b61f11f1b
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2
github.com/libdns/alidns v1.0.3
github.com/libdns/cloudflare v0.1.0
github.com/libdns/cloudflare v0.1.1
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/mholt/acmez v1.2.0
github.com/miekg/dns v1.1.58
Expand All @@ -30,14 +30,14 @@ require (
github.com/sagernet/gvisor v0.0.0-20231209105102-8d27a30e436e
github.com/sagernet/quic-go v0.40.1
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691
github.com/sagernet/sing v0.3.6
github.com/sagernet/sing-dns v0.1.12
github.com/sagernet/sing v0.3.8
github.com/sagernet/sing-dns v0.1.14
github.com/sagernet/sing-mux v0.2.0
github.com/sagernet/sing-quic v0.1.8
github.com/sagernet/sing-quic v0.1.11
github.com/sagernet/sing-shadowsocks v0.2.6
github.com/sagernet/sing-shadowsocks2 v0.2.0
github.com/sagernet/sing-shadowtls v0.1.4
github.com/sagernet/sing-tun v0.2.4
github.com/sagernet/sing-tun v0.2.6
github.com/sagernet/sing-vmess v0.1.8
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7
github.com/sagernet/tfo-go v0.0.0-20231209031829-7b5343ac1dc6
Expand All @@ -47,11 +47,11 @@ require (
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
golang.org/x/crypto v0.21.0
golang.org/x/net v0.22.0
golang.org/x/sys v0.18.0
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0
golang.org/x/sys v0.19.0
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
google.golang.org/grpc v1.62.1
google.golang.org/grpc v1.63.0
google.golang.org/protobuf v1.33.0
howett.net/plist v1.0.1
)
Expand All @@ -69,15 +69,14 @@ require (
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/libdns/libdns v0.2.1 // indirect
github.com/libdns/libdns v0.2.2 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/onsi/ginkgo/v2 v2.9.7 // indirect
github.com/pierrec/lz4/v4 v4.1.14 // indirect
Expand All @@ -90,18 +89,17 @@ require (
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.4.1 // indirect
github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 // indirect
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/u-root/uio v0.0.0-20230220225925-ffce2a382923 // indirect
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
Expand Down
Loading

1 comment on commit 9744514

@Graveyard9988
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies
Please upgrade sing box core to 1.8.11 because of critical issues of current core

Regards

Please sign in to comment.