mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-26 13:06:56 +00:00
Close idle connections of unreferenced outbounds and DNS servers
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user