Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
81ff3ee
refactor: DNS
nekohasekai Mar 16, 2025
3ab6e6c
refactor: Outbound domain resolver
nekohasekai Jan 12, 2025
912bd00
Add TLS fragment support
nekohasekai Jan 26, 2025
dd89730
Add certificate store
nekohasekai Jan 8, 2025
24cf4e9
documentation: Refactor DNS
nekohasekai Jan 25, 2025
aef0d47
documentation: Outbound domain resolver
nekohasekai Jan 29, 2025
74f1c3a
documentation: TLS fragment
nekohasekai Jan 30, 2025
d21d724
documentation: Certificate store
nekohasekai Jan 30, 2025
750a9be
documentation: Remove outdated icons
nekohasekai Jan 30, 2025
5dd1a09
Build legacy binaries with latest Go
nekohasekai Feb 12, 2025
7b095b7
Add Tailscale endpoint
nekohasekai Apr 6, 2025
3439b75
Remove single quotes of raw Moziila certs
xchacha20-poly1305 Feb 12, 2025
18e9eaa
Add back port hopping to hysteria 1
nekohasekai Feb 16, 2025
7d0d59c
Improve resolve action
nekohasekai Feb 20, 2025
095721e
Get darwin local DNS server from libresolv
nekohasekai Feb 20, 2025
2a03668
Add fallback local DNS server for iOS
nekohasekai Feb 20, 2025
7cc6e1c
Migrate to stdlib ECH support
nekohasekai Feb 22, 2025
9dbd482
Add AnyTLS protocol
anytls Feb 20, 2025
4918580
documentation: Fix AnyTLS doc
nekohasekai Feb 22, 2025
f329e85
Fix Outbound deadlock
alireza0 Feb 23, 2025
92c6390
documentation: Fix typo
libtry486 Feb 23, 2025
88b4a8a
documentation: Minor fixes
Feb 20, 2025
75e0ce9
Add MinIdleSession option to AnyTLS outbound
anytls Feb 24, 2025
afdf750
documentation: Fix missing hosts DNS server
nekohasekai Feb 24, 2025
27fa1a7
Fix DNS fallback
nekohasekai Feb 25, 2025
753f036
Fix parsing legacy DNS options
TargetLocked Feb 25, 2025
ad2ff84
documentation: Fix typo
BedrockDigger Feb 25, 2025
4879dd6
Update sing-anytls
anytls Feb 25, 2025
0d300cd
Fix missing AnyTLS display name
Zephyruso Feb 25, 2025
243a40a
Fix domain resolver on direct outbound
nekohasekai Feb 26, 2025
6e8eff3
Move predefined DNS server to rule action
nekohasekai Feb 26, 2025
15e4198
Fix anytls dialer usage
nekohasekai Feb 27, 2025
2e196eb
documentation: Fix missing `ip_accept_any` DNS rule option
nekohasekai Mar 6, 2025
0ddef18
Fix UDP DNS server crash
nekohasekai Mar 6, 2025
f4b6f82
Fix hosts DNS server
k9982874 Mar 10, 2025
ada4633
Update sing-anytls
anytls Mar 10, 2025
27efb76
documentation: Fix typo
Restia-Ashbell Mar 10, 2025
d1ebc72
Fix http3 DNS server connecting to wrong address
nekohasekai Mar 13, 2025
883e9da
Fix DNS lookup context pollution
nekohasekai Mar 13, 2025
cf77712
Make `domain_resolver` optional when only one DNS server is configured
nekohasekai Mar 15, 2025
2167079
option: Fix marshal legacy DNS options
nekohasekai Mar 15, 2025
47a717c
Add ntp protocol sniffing
k9982874 Mar 15, 2025
6cb3030
Add wildcard-sni support for shadow-tls inbound
nekohasekai Mar 16, 2025
3b53ca6
Fix unhandled DNS loop
nekohasekai Mar 17, 2025
b5f5e94
Remove map usage in options
nekohasekai Mar 18, 2025
264c67f
Add wildcard name support for predefined records
nekohasekai Mar 18, 2025
e3405c6
Add netns support
nekohasekai Mar 18, 2025
b7f55e9
Explicitly reject detour to empty direct outbounds
nekohasekai Mar 20, 2025
0297835
Update gVisor to 20250319.0
nekohasekai Mar 24, 2025
9d3c47b
Fail when default DNS server not found
nekohasekai Mar 24, 2025
e534284
Fix missing `with_tailscale` in Dockerfile
Mar 26, 2025
45d2096
Update anytls
anytls Mar 27, 2025
7ef938e
Fix DNS over QUIC stream close
dyhkwong Mar 27, 2025
9bd9512
Fix Tailscale dialer
nekohasekai Mar 28, 2025
8337505
Allow direct outbounds without `domain_resolver`
nekohasekai Apr 1, 2025
23a99c2
Fix fetch ECH configs
Apr 6, 2025
10afe58
Fix UDP DNS server crash
iikira Apr 6, 2025
1f07157
release: Skip override version for iOS
nekohasekai Apr 8, 2025
d6bd251
Fix DNS dialer
nekohasekai Apr 8, 2025
f2cb235
Update anytls
anytls Apr 9, 2025
d0052e3
Improve local DNS server
nekohasekai Apr 12, 2025
c2e962f
Fix missing handling of legacy `domain_strategy` options
nekohasekai Apr 17, 2025
2f3ebe6
documentation: Try to make the play review happy
nekohasekai Apr 17, 2025
5a1d726
Fix callback deletion in UDP transport
caelansar Apr 19, 2025
1f35f25
documentation: Minor fixes
Apr 19, 2025
ebaaee7
Fix fetch ECH configs
nekohasekai Apr 22, 2025
de31c31
Fix DNS lookup
nekohasekai Apr 25, 2025
fbd7933
clash-api: Add more meta api
nekohasekai Apr 25, 2025
886ea0c
Fix wireguard `listen_port`
nekohasekai Apr 26, 2025
9fc4244
Report invalid DNS address early
xchacha20-poly1305 Apr 26, 2025
2e20110
documentation: Fix anytls padding scheme description
nekohasekai Apr 28, 2025
b026e78
Handle EDNS version downgrade
nekohasekai Apr 30, 2025
0d9883b
Update utls to v1.7.2
nekohasekai May 3, 2025
26f0c5d
Update quic-go to v0.52.0
nekohasekai May 5, 2025
115eb9e
Add control options for listeners
nekohasekai May 5, 2025
3c07a9d
Update protobuf and grpc
nekohasekai May 5, 2025
ecfd010
Update certmagic and providers
nekohasekai May 5, 2025
1016ba6
Update minor dependencies
nekohasekai May 5, 2025
d276db1
Fix set edns0 client subnet
nekohasekai May 7, 2025
44ada21
Add TLS record fragment support
nekohasekai May 12, 2025
f6898a7
Add missing `accept_routes` option for Tailscale
nekohasekai May 12, 2025
009b224
Fix TLS record fragment
Restia-Ashbell May 13, 2025
aeb3401
documentation: Fix description of reject DNS action behavior
PuerNya May 16, 2025
aa2a4ea
prevent creation of bind and mark controls on unsupported platforms
nekohasekai May 16, 2025
f5dd883
release: Fix build tags for android
FansChou May 17, 2025
e68036e
Fix tproxy tcp control
nekohasekai May 18, 2025
2ded81f
Add service component type
nekohasekai Mar 29, 2025
7774f16
Add DERP service
nekohasekai Mar 29, 2025
65a629c
Add resolved service and DNS server
nekohasekai Mar 30, 2025
f0e42f8
Add SSM API service
nekohasekai Apr 14, 2025
cd7229f
Minor fixes
nekohasekai May 23, 2025
301549f
Fix tailscale forward
nekohasekai May 23, 2025
656301b
documentation: Minor fixes
nekohasekai May 29, 2025
2dfe93c
Fix `dns.client_subnet` ignored
nekohasekai May 29, 2025
867c267
documentation: Fix services
ZeroClover Jun 4, 2025
de7e036
Fix missing home for derp service
nekohasekai Jun 4, 2025
3f38520
Fix systemd package
nekohasekai Jun 5, 2025
7291d7e
Fix tproxy listener
nekohasekai Jun 8, 2025
d0824ea
release: Update Go to 1.24.4
nekohasekai Apr 3, 2025
ce013ce
documentation: Bump version
nekohasekai Apr 28, 2025
c86f47b
Add loopback address support for tun
nekohasekai Jun 10, 2025
8b15576
Fix service will not be closed
nekohasekai Jun 10, 2025
e7ae3dd
Add cache support for ssm-api
nekohasekai Jun 10, 2025
0a5f09f
Improve TLS fragments
nekohasekai Jun 12, 2025
d8e1cd0
Add ECH support for uTLS
Restia-Ashbell Jun 12, 2025
0e5f181
documentation: Bump version
nekohasekai Jun 10, 2025
e19a63b
feat: fallback outbound
PA733 Jun 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .fpm_systemd
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
--deb-field "Bug: https://github.com/SagerNet/sing-box/issues"
--no-deb-generate-changes
--config-files /etc/sing-box/config.json
--after-install release/config/sing-box.postinst

release/config/config.json=/etc/sing-box/config.json

release/config/sing-box.service=/usr/lib/systemd/system/sing-box.service
release/config/sing-box@.service=/usr/lib/systemd/system/sing-box@.service
release/config/sing-box.sysusers=/usr/lib/sysusers.d/sing-box.conf
release/config/sing-box.rules=usr/share/polkit-1/rules.d/sing-box.rules
release/config/sing-box-split-dns.xml=/usr/share/dbus-1/system.d/sing-box-split-dns.conf

release/completions/sing-box.bash=/usr/share/bash-completion/completions/sing-box.bash
release/completions/sing-box.fish=/usr/share/fish/vendor_completions.d/sing-box.fish
Expand Down
25 changes: 25 additions & 0 deletions .github/setup_legacy_go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

VERSION="1.23.6"

mkdir -p $HOME/go
cd $HOME/go
wget "https://dl.google.com/go/go${VERSION}.linux-amd64.tar.gz"
tar -xzf "go${VERSION}.linux-amd64.tar.gz"
mv go go_legacy
cd go_legacy

# modify from https://github.com/restic/restic/issues/4636#issuecomment-1896455557
# this patch file only works on golang1.23.x
# that means after golang1.24 release it must be changed
# see: https://github.com/MetaCubeX/go/commits/release-branch.go1.23/
# revert:
# 693def151adff1af707d82d28f55dba81ceb08e1: "crypto/rand,runtime: switch RtlGenRandom for ProcessPrng"
# 7c1157f9544922e96945196b47b95664b1e39108: "net: remove sysSocket fallback for Windows 7"
# 48042aa09c2f878c4faa576948b07fe625c4707a: "syscall: remove Windows 7 console handle workaround"
# a17d959debdb04cd550016a3501dd09d50cd62e7: "runtime: always use LoadLibraryEx to load system libraries"

curl https://github.com/MetaCubeX/go/commit/9ac42137ef6730e8b7daca016ece831297a1d75b.diff | patch --verbose -p 1
curl https://github.com/MetaCubeX/go/commit/21290de8a4c91408de7c2b5b68757b1e90af49dd.diff | patch --verbose -p 1
curl https://github.com/MetaCubeX/go/commit/6a31d3fa8e47ddabc10bd97bff10d9a85f4cfb76.diff | patch --verbose -p 1
curl https://github.com/MetaCubeX/go/commit/69e2eed6dd0f6d815ebf15797761c13f31213dd6.diff | patch --verbose -p 1
43 changes: 27 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: Check input version
if: github.event_name == 'workflow_dispatch'
run: |-
Expand Down Expand Up @@ -94,7 +94,6 @@ jobs:
- { os: windows, arch: arm64 }

- { os: darwin, arch: amd64 }
- { os: darwin, arch: amd64, legacy_go: true }
- { os: darwin, arch: arm64 }

- { os: android, arch: arm64, ndk: "aarch64-linux-android21" }
Expand All @@ -106,16 +105,28 @@ jobs:
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: Setup Go
if: matrix.legacy_go
uses: actions/setup-go@v5
with:
go-version: ~1.20
- name: Setup Go
if: ${{ ! matrix.legacy_go }}
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: Cache Legacy Go
if: matrix.require_legacy_go
id: cache-legacy-go
uses: actions/cache@v4
with:
path: |
~/go/go_legacy
key: go_legacy_1236
- name: Setup Legacy Go
if: matrix.legacy_go && steps.cache-legacy-go.outputs.cache-hit != 'true'
run: |-
.github/setup_legacy_go.sh
- name: Setup Legacy Go 2
if: matrix.legacy_go
run: |-
echo "PATH=$HOME/go/go_legacy/bin:$PATH" >> $GITHUB_ENV
echo "GOROOT=$HOME/go/go_legacy" >> $GITHUB_ENV
- name: Setup Android NDK
if: matrix.os == 'android'
uses: nttld/setup-ndk@v1
Expand All @@ -129,10 +140,7 @@ jobs:
- name: Set build tags
run: |
set -xeuo pipefail
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_reality_server,with_acme,with_clash_api'
if [ ! '${{ matrix.legacy_go }}' = 'true' ]; then
TAGS="${TAGS},with_ech"
fi
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale'
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
- name: Build
if: matrix.os != 'android'
Expand Down Expand Up @@ -286,7 +294,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
Expand Down Expand Up @@ -366,7 +374,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: Setup Android NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
Expand Down Expand Up @@ -464,7 +472,7 @@ jobs:
if: matrix.if
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: Setup Xcode stable
if: matrix.if && github.ref == 'refs/heads/main-next'
run: |-
Expand Down Expand Up @@ -541,10 +549,13 @@ jobs:
MACOS_PROJECT_VERSION=$(go run -v ./cmd/internal/app_store_connect next_macos_project_version)
echo "MACOS_PROJECT_VERSION=$MACOS_PROJECT_VERSION"
echo "MACOS_PROJECT_VERSION=$MACOS_PROJECT_VERSION" >> "$GITHUB_ENV"
- name: Update version
if: matrix.if && matrix.name != 'iOS'
run: |-
go run -v ./cmd/internal/update_apple_version --ci
- name: Build
if: matrix.if
run: |-
go run -v ./cmd/internal/update_apple_version --ci
cd clients/apple
xcodebuild archive \
-scheme "${{ matrix.scheme }}" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: Check input version
if: github.event_name == 'workflow_dispatch'
run: |-
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.24.4
- name: Setup Android NDK
if: matrix.os == 'android'
uses: nttld/setup-ndk@v1
Expand All @@ -80,10 +80,7 @@ jobs:
- name: Set build tags
run: |
set -xeuo pipefail
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_reality_server,with_acme,with_clash_api'
if [ ! '${{ matrix.legacy_go }}' = 'true' ]; then
TAGS="${TAGS},with_ech"
fi
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale'
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
- name: Build
run: |
Expand Down
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ run:
- with_quic
- with_dhcp
- with_wireguard
- with_ech
- with_utls
- with_reality_server
- with_acme
- with_clash_api

Expand Down
13 changes: 10 additions & 3 deletions .goreleaser.fury.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ builds:
- -v
- -trimpath
ldflags:
- -X github.com/sagernet/sing-box/constant.Version={{ .Version }} -s -w -buildid=
- -X github.com/sagernet/sing-box/constant.Version={{ .Version }}
- -s
- -buildid=
tags:
- with_gvisor
- with_quic
- with_dhcp
- with_wireguard
- with_ech
- with_utls
- with_reality_server
- with_acme
- with_clash_api
- with_tailscale
env:
- CGO_ENABLED=0
targets:
Expand Down Expand Up @@ -54,6 +55,12 @@ nfpms:
dst: /usr/lib/systemd/system/sing-box.service
- src: release/config/sing-box@.service
dst: /usr/lib/systemd/system/sing-box@.service
- src: release/config/sing-box.sysusers
dst: /usr/lib/sysusers.d/sing-box.conf
- src: release/config/sing-box.rules
dst: /usr/share/polkit-1/rules.d/sing-box.rules
- src: release/config/sing-box-split-dns.xml
dst: /usr/share/dbus-1/system.d/sing-box-split-dns.conf

- src: release/completions/sing-box.bash
dst: /usr/share/bash-completion/completions/sing-box.bash
Expand Down
18 changes: 12 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ builds:
- with_quic
- with_dhcp
- with_wireguard
- with_ech
- with_utls
- with_reality_server
- with_acme
- with_clash_api
- with_tailscale
env:
- CGO_ENABLED=0
- GOTOOLCHAIN=local
targets:
- linux_386
- linux_amd64_v1
Expand All @@ -46,21 +46,21 @@ builds:
- with_dhcp
- with_wireguard
- with_utls
- with_reality_server
- with_acme
- with_clash_api
- with_tailscale
env:
- CGO_ENABLED=0
- GOROOT={{ .Env.GOPATH }}/go1.20.14
tool: "{{ .Env.GOPATH }}/go1.20.14/bin/go"
- GOROOT={{ .Env.GOPATH }}/go_legacy
tool: "{{ .Env.GOPATH }}/go_legacy/bin/go"
targets:
- windows_amd64_v1
- windows_386
- darwin_amd64_v1
- id: android
<<: *template
env:
- CGO_ENABLED=1
- GOTOOLCHAIN=local
overrides:
- goos: android
goarch: arm
Expand Down Expand Up @@ -136,6 +136,12 @@ nfpms:
dst: /usr/lib/systemd/system/sing-box.service
- src: release/config/sing-box@.service
dst: /usr/lib/systemd/system/sing-box@.service
- src: release/config/sing-box.sysusers
dst: /usr/lib/sysusers.d/sing-box.conf
- src: release/config/sing-box.rules
dst: /usr/share/polkit-1/rules.d/sing-box.rules
- src: release/config/sing-box-split-dns.xml
dst: /usr/share/dbus-1/system.d/sing-box-split-dns.conf

- src: release/completions/sing-box.bash
dst: /usr/share/bash-completion/completions/sing-box.bash
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN set -ex \
&& export COMMIT=$(git rev-parse --short HEAD) \
&& export VERSION=$(go run ./cmd/internal/read_tag) \
&& go build -v -trimpath -tags \
"with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api" \
"with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale" \
-o /go/bin/sing-box \
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid=" \
./cmd/sing-box
Expand Down
22 changes: 10 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
NAME = sing-box
COMMIT = $(shell git rev-parse --short HEAD)
TAGS_GO120 = with_gvisor,with_dhcp,with_wireguard,with_reality_server,with_clash_api,with_quic,with_utls
TAGS_GO121 = with_ech
TAGS ?= $(TAGS_GO118),$(TAGS_GO120),$(TAGS_GO121)
TAGS_TEST ?= with_gvisor,with_quic,with_wireguard,with_grpc,with_ech,with_utls,with_reality_server
TAGS ?= with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale

GOHOSTOS = $(shell go env GOHOSTOS)
GOHOSTARCH = $(shell go env GOHOSTARCH)
VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run ./cmd/internal/read_tag)
VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run github.com/sagernet/sing-box/cmd/internal/read_tag@latest)

PARAMS = -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=$(VERSION)' -s -w -buildid="
MAIN_PARAMS = $(PARAMS) -tags "$(TAGS)"
Expand All @@ -17,14 +14,12 @@ PREFIX ?= $(shell go env GOPATH)
.PHONY: test release docs build

build:
export GOTOOLCHAIN=local && \
go build $(MAIN_PARAMS) $(MAIN)

ci_build_go120:
go build $(PARAMS) $(MAIN)
go build $(PARAMS) -tags "$(TAGS_GO120)" $(MAIN)

ci_build:
go build $(PARAMS) $(MAIN)
export GOTOOLCHAIN=local && \
go build $(PARAMS) $(MAIN) && \
go build $(MAIN_PARAMS) $(MAIN)

generate_completions:
Expand Down Expand Up @@ -61,6 +56,9 @@ proto_install:
go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

update_certificates:
go run ./cmd/internal/update_certificates

release:
go run ./cmd/internal/build goreleaser release --clean --skip publish
mkdir dist/release
Expand Down Expand Up @@ -227,8 +225,8 @@ lib:
go run ./cmd/internal/build_libbox -target ios

lib_install:
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.4
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.4
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.6
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.6

docs:
venv/bin/mkdocs serve
Expand Down
21 changes: 21 additions & 0 deletions adapter/certificate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package adapter

import (
"context"
"crypto/x509"

"github.com/sagernet/sing/service"
)

type CertificateStore interface {
LifecycleService
Pool() *x509.CertPool
}

func RootPoolFromContext(ctx context.Context) *x509.CertPool {
store := service.FromContext[CertificateStore](ctx)
if store == nil {
return nil
}
return store.Pool()
}
Loading