add options for components

This commit is contained in:
ginuerzh
2023-10-26 22:20:10 +08:00
parent 33adbb9027
commit e5fa371586
21 changed files with 42 additions and 42 deletions

View File

@ -30,10 +30,10 @@ type admissionWrapper struct {
r *admissionRegistry
}
func (w *admissionWrapper) Admit(ctx context.Context, addr string) bool {
func (w *admissionWrapper) Admit(ctx context.Context, addr string, opts ...admission.Option) bool {
p := w.r.get(w.name)
if p == nil {
return false
}
return p.Admit(ctx, addr)
return p.Admit(ctx, addr, opts...)
}

View File

@ -30,10 +30,10 @@ type autherWrapper struct {
r *autherRegistry
}
func (w *autherWrapper) Authenticate(ctx context.Context, user, password string) (string, bool) {
func (w *autherWrapper) Authenticate(ctx context.Context, user, password string, opts ...auth.Option) (string, bool) {
v := w.r.get(w.name)
if v == nil {
return "", true
}
return v.Authenticate(ctx, user, password)
return v.Authenticate(ctx, user, password, opts...)
}

View File

@ -31,10 +31,10 @@ type hostsWrapper struct {
r *hostsRegistry
}
func (w *hostsWrapper) Lookup(ctx context.Context, network, host string) ([]net.IP, bool) {
func (w *hostsWrapper) Lookup(ctx context.Context, network, host string, opts ...hosts.Option) ([]net.IP, bool) {
v := w.r.get(w.name)
if v == nil {
return nil, false
}
return v.Lookup(ctx, network, host)
return v.Lookup(ctx, network, host, opts...)
}

View File

@ -30,19 +30,19 @@ type ingressWrapper struct {
r *ingressRegistry
}
func (w *ingressWrapper) Get(ctx context.Context, host string) string {
func (w *ingressWrapper) Get(ctx context.Context, host string, opts ...ingress.GetOption) string {
v := w.r.get(w.name)
if v == nil {
return ""
}
return v.Get(ctx, host)
return v.Get(ctx, host, opts...)
}
func (w *ingressWrapper) Set(ctx context.Context, host, endpoint string) {
func (w *ingressWrapper) Set(ctx context.Context, host, endpoint string, opts ...ingress.SetOption) {
v := w.r.get(w.name)
if v == nil {
return
}
v.Set(ctx, host, endpoint)
v.Set(ctx, host, endpoint, opts...)
}

View File

@ -30,10 +30,10 @@ type recorderWrapper struct {
r *recorderRegistry
}
func (w *recorderWrapper) Record(ctx context.Context, b []byte) error {
func (w *recorderWrapper) Record(ctx context.Context, b []byte, opts ...recorder.RecordOption) error {
v := w.r.get(w.name)
if v == nil {
return nil
}
return v.Record(ctx, b)
return v.Record(ctx, b, opts...)
}

View File

@ -31,10 +31,10 @@ type resolverWrapper struct {
r *resolverRegistry
}
func (w *resolverWrapper) Resolve(ctx context.Context, network, host string) ([]net.IP, error) {
func (w *resolverWrapper) Resolve(ctx context.Context, network, host string, opts ...resolver.Option) ([]net.IP, error) {
r := w.r.get(w.name)
if r == nil {
return nil, resolver.ErrInvalid
}
return r.Resolve(ctx, network, host)
return r.Resolve(ctx, network, host, opts...)
}