Add clash persistence support

This commit is contained in:
世界
2022-09-10 14:40:16 +08:00
parent a62774c51c
commit 755d187ce1
8 changed files with 140 additions and 19 deletions

View File

@@ -10,10 +10,17 @@ import (
type ClashServer interface {
Service
Mode() string
StoreSelected() bool
CacheFile() ClashCacheFile
RoutedConnection(ctx context.Context, conn net.Conn, metadata InboundContext, matchedRule Rule) (net.Conn, Tracker)
RoutedPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, matchedRule Rule) (N.PacketConn, Tracker)
}
type ClashCacheFile interface {
LoadSelected(group string) string
StoreSelected(group string, selected string) error
}
type Tracker interface {
Leave()
}