Close idle connections of unreferenced outbounds and DNS servers

This commit is contained in:
世界
2026-10-02 18:00:09 +08:00
parent d2cf9747d7
commit fd9a076d25
40 changed files with 851 additions and 81 deletions
+9 -1
View File
@@ -32,12 +32,16 @@ type Outbound struct {
serverAddr M.Socksaddr
}
var _ adapter.InterfaceUpdateListener = (*Outbound)(nil)
var (
_ adapter.InterfaceUpdateListener = (*Outbound)(nil)
_ adapter.IdleConnectionCloser = (*Outbound)(nil)
)
type snellClient interface {
snellprotocol.Method
DialContext(ctx context.Context, destination M.Socksaddr) (net.Conn, error)
Reset()
CloseIdleConnections()
Close() error
}
@@ -143,6 +147,10 @@ func (h *Outbound) InterfaceUpdated(ctx context.Context) {
h.client.Reset()
}
func (h *Outbound) CloseIdleConnections() {
h.client.CloseIdleConnections()
}
func (h *Outbound) Close() error {
return h.client.Close()
}