mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-13 20:28:32 +10:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7bed32c6f | ||
|
|
ef7f2d82c0 | ||
|
|
7aa97a332e | ||
|
|
7c30dde96b | ||
|
|
9cef2a0a8f |
@@ -1,6 +1,6 @@
|
|||||||
package constant
|
package constant
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Version = "1.0"
|
Version = "1.0.1"
|
||||||
Commit = ""
|
Commit = ""
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 |
|
||||||
|
|||||||
@@ -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
|
||||||
```
|
```
|
||||||
|
|
||||||
| 构建标志 | 描述 |
|
| 构建标志 | 描述 |
|
||||||
|
|||||||
@@ -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{
|
||||||
|
|||||||
@@ -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())
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user