add netns option for handler and listener

This commit is contained in:
ginuerzh 2024-06-24 21:13:23 +08:00
parent 5aede9a2b3
commit ca340b1bf1
2 changed files with 15 additions and 1 deletions

View File

@ -25,6 +25,7 @@ type Options struct {
Logger logger.Logger
Observer observer.Observer
Service string
Netns string
}
type Option func(opts *Options)
@ -89,6 +90,12 @@ func ServiceOption(service string) Option {
}
}
func NetnsOption(netns string) Option {
return func(opts *Options) {
opts.Netns = netns
}
}
type HandleOptions struct {
Metadata metadata.Metadata
}

View File

@ -26,6 +26,7 @@ type Options struct {
Logger logger.Logger
Service string
ProxyProtocol int
Netns string
}
type Option func(opts *Options)
@ -101,3 +102,9 @@ func ProxyProtocolOption(ppv int) Option {
opts.ProxyProtocol = ppv
}
}
func NetnsOption(netns string) Option {
return func(opts *Options) {
opts.Netns = netns
}
}