Fix system nat mapping
This commit is contained in:
parent
bf7110b1ab
commit
53f50347e0
4 changed files with 60 additions and 23 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package tun
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sagernet/sing/common"
|
||||
"github.com/sagernet/sing/common/cache"
|
||||
)
|
||||
|
|
@ -9,9 +11,10 @@ type RouteMapping struct {
|
|||
status *cache.LruCache[RouteSession, RouteAction]
|
||||
}
|
||||
|
||||
func NewRouteMapping(maxAge int64) *RouteMapping {
|
||||
func NewRouteMapping(ctx context.Context, maxAge int64) *RouteMapping {
|
||||
return &RouteMapping{
|
||||
status: cache.New(
|
||||
cache.WithContext[RouteSession, RouteAction](ctx),
|
||||
cache.WithAge[RouteSession, RouteAction](maxAge),
|
||||
cache.WithUpdateAgeOnGet[RouteSession, RouteAction](),
|
||||
cache.WithEvict[RouteSession, RouteAction](func(key RouteSession, conn RouteAction) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue