Add DHCP DNS server support

This commit is contained in:
世界
2023-02-08 16:28:52 +08:00
parent 66f1d43783
commit b4902fe36c
12 changed files with 427 additions and 38 deletions

View File

@@ -47,6 +47,20 @@ type Router interface {
SetV2RayServer(server V2RayServer)
}
type routerContextKey struct{}
func ContextWithRouter(ctx context.Context, router Router) context.Context {
return context.WithValue(ctx, (*routerContextKey)(nil), router)
}
func RouterFromContext(ctx context.Context) Router {
metadata := ctx.Value((*routerContextKey)(nil))
if metadata == nil {
return nil
}
return metadata.(Router)
}
type Rule interface {
Service
Type() string