Compare commits

...

5 Commits
v1.0 ... v1.0.1

Author SHA1 Message Date
世界
f7bed32c6f Bump version 2022-09-09 14:43:42 +08:00
世界
ef7f2d82c0 Fix match 4in6 address in ip_cidr 2022-09-09 14:07:02 +08:00
世界
7aa97a332e Fix documentation 2022-09-09 13:54:02 +08:00
世界
7c30dde96b Minor fixes 2022-09-08 18:33:59 +08:00
GyDi
9cef2a0a8f Fix clashapi log level format error 2022-09-08 18:04:06 +08:00
8 changed files with 26 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
package constant package constant
var ( var (
Version = "1.0" Version = "1.0.1"
Commit = "" Commit = ""
) )

View File

@@ -1,3 +1,9 @@
#### 1.0.1
* Fix match 4in6 address in ip_cidr
* Fix clash api log level format error
* Fix clash api unknown proxy type
#### 1.0 #### 1.0
* Fix wireguard reconnect * Fix wireguard reconnect

View File

@@ -13,13 +13,13 @@ The universal proxy platform.
sing-box requires Golang **1.18.5** or a higher version. sing-box requires Golang **1.18.5** or a higher version.
```bash ```bash
go install -v github.com/sagernet/sing-box/cmd/sing-box@v1.0-beta2 go install -v github.com/sagernet/sing-box/cmd/sing-box@latest
``` ```
Install with options: Install with options:
```bash ```bash
go install -v -tags with_clash_api github.com/sagernet/sing-box/cmd/sing-box@v1.0-beta2 go install -v -tags with_clash_api github.com/sagernet/sing-box/cmd/sing-box@latest
``` ```
| Build Tag | Description | | Build Tag | Description |

View File

@@ -13,13 +13,13 @@ description: 欢迎来到该 sing-box 项目的文档页。
sing-box 需要 Golang **1.18.5** 或更高版本。 sing-box 需要 Golang **1.18.5** 或更高版本。
```bash ```bash
go install -v github.com/sagernet/sing-box/cmd/sing-box@v1.0-beta2 go install -v github.com/sagernet/sing-box/cmd/sing-box@latest
``` ```
自定义安装: 自定义安装:
```bash ```bash
go install -v -tags with_clash_api github.com/sagernet/sing-box/cmd/sing-box@v1.0-beta2 go install -v -tags with_clash_api github.com/sagernet/sing-box/cmd/sing-box@latest
``` ```
| 构建标志 | 描述 | | 构建标志 | 描述 |

View File

@@ -36,7 +36,7 @@ func getConfigs(logFactory log.Factory) func(w http.ResponseWriter, r *http.Requ
logLevel := logFactory.Level() logLevel := logFactory.Level()
if logLevel == log.LevelTrace { if logLevel == log.LevelTrace {
logLevel = log.LevelDebug logLevel = log.LevelDebug
} else if logLevel > log.LevelError { } else if logLevel < log.LevelError {
logLevel = log.LevelError logLevel = log.LevelError
} }
render.JSON(w, r, &configSchema{ render.JSON(w, r, &configSchema{

View File

@@ -75,11 +75,13 @@ func proxyInfo(server *Server, detour adapter.Outbound) *badjson.JSONObject {
clashType = "Shadowsocks" clashType = "Shadowsocks"
case C.TypeVMess: case C.TypeVMess:
clashType = "Vmess" clashType = "Vmess"
case C.TypeTrojan:
clashType = "Trojan"
case C.TypeSelector: case C.TypeSelector:
clashType = "Selector" clashType = "Selector"
isGroup = true isGroup = true
default: default:
clashType = "Unknown" clashType = "Socks"
} }
info.Put("type", clashType) info.Put("type", clashType)
info.Put("name", detour.Tag()) info.Put("name", detour.Tag())

View File

@@ -59,13 +59,13 @@ func NewIPCIDRItem(isSource bool, prefixStrings []string) (*IPCIDRItem, error) {
func (r *IPCIDRItem) Match(metadata *adapter.InboundContext) bool { func (r *IPCIDRItem) Match(metadata *adapter.InboundContext) bool {
if r.isSource { if r.isSource {
return r.ipSet.Contains(metadata.Source.Addr) return r.match(metadata.Source.Addr)
} else { } else {
if metadata.Destination.IsIP() { if metadata.Destination.IsIP() {
return r.ipSet.Contains(metadata.Destination.Addr) return r.match(metadata.Destination.Addr)
} else { } else {
for _, address := range metadata.DestinationAddresses { for _, address := range metadata.DestinationAddresses {
if r.ipSet.Contains(address) { if r.match(address) {
return true return true
} }
} }
@@ -74,6 +74,14 @@ func (r *IPCIDRItem) Match(metadata *adapter.InboundContext) bool {
return false return false
} }
func (r *IPCIDRItem) match(address netip.Addr) bool {
if address.Is4In6() {
return r.ipSet.Contains(netip.AddrFrom4(address.As4()))
} else {
return r.ipSet.Contains(address)
}
}
func (r *IPCIDRItem) String() string { func (r *IPCIDRItem) String() string {
return r.description return r.description
} }

View File

@@ -61,10 +61,6 @@ func (s *StreamWrapper) Upstream() any {
return s.Stream return s.Stream
} }
func (s *StreamWrapper) WriterReplaceable() bool {
return true
}
func (s *StreamWrapper) Close() error { func (s *StreamWrapper) Close() error {
s.CancelRead(0) s.CancelRead(0)
s.Stream.Close() s.Stream.Close()