2022-12-05 00:20:50 +08:00
|
|
|
package inbound
|
|
|
|
|
|
|
|
import (
|
|
|
|
C "github.com/Dreamacro/clash/constant"
|
|
|
|
)
|
|
|
|
|
2022-12-05 10:12:53 +08:00
|
|
|
type Addition func(metadata *C.Metadata)
|
2022-12-05 00:20:50 +08:00
|
|
|
|
|
|
|
func (a Addition) Apply(metadata *C.Metadata) {
|
2022-12-05 10:12:53 +08:00
|
|
|
a(metadata)
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithInName(name string) Addition {
|
|
|
|
return func(metadata *C.Metadata) {
|
|
|
|
metadata.InName = name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-28 17:19:57 +08:00
|
|
|
func WithInUser(user string) Addition {
|
|
|
|
return func(metadata *C.Metadata) {
|
|
|
|
metadata.InUser = user
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-05 10:12:53 +08:00
|
|
|
func WithSpecialRules(specialRules string) Addition {
|
|
|
|
return func(metadata *C.Metadata) {
|
|
|
|
metadata.SpecialRules = specialRules
|
|
|
|
}
|
2022-12-05 00:20:50 +08:00
|
|
|
}
|
2022-12-05 17:53:54 +08:00
|
|
|
|
|
|
|
func WithSpecialProxy(specialProxy string) Addition {
|
|
|
|
return func(metadata *C.Metadata) {
|
|
|
|
metadata.SpecialProxy = specialProxy
|
|
|
|
}
|
|
|
|
}
|