add plugin system
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-gost/core/admission"
|
||||
)
|
||||
|
||||
@ -28,10 +30,10 @@ type admissionWrapper struct {
|
||||
r *admissionRegistry
|
||||
}
|
||||
|
||||
func (w *admissionWrapper) Admit(addr string) bool {
|
||||
func (w *admissionWrapper) Admit(ctx context.Context, addr string) bool {
|
||||
p := w.r.get(w.name)
|
||||
if p == nil {
|
||||
return false
|
||||
}
|
||||
return p.Admit(addr)
|
||||
return p.Admit(ctx, addr)
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-gost/core/auth"
|
||||
)
|
||||
|
||||
@ -28,10 +30,10 @@ type autherWrapper struct {
|
||||
r *autherRegistry
|
||||
}
|
||||
|
||||
func (w *autherWrapper) Authenticate(user, password string) bool {
|
||||
func (w *autherWrapper) Authenticate(ctx context.Context, user, password string) bool {
|
||||
v := w.r.get(w.name)
|
||||
if v == nil {
|
||||
return true
|
||||
}
|
||||
return v.Authenticate(user, password)
|
||||
return v.Authenticate(ctx, user, password)
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-gost/core/bypass"
|
||||
)
|
||||
|
||||
@ -28,10 +30,10 @@ type bypassWrapper struct {
|
||||
r *bypassRegistry
|
||||
}
|
||||
|
||||
func (w *bypassWrapper) Contains(addr string) bool {
|
||||
func (w *bypassWrapper) Contains(ctx context.Context, addr string) bool {
|
||||
bp := w.r.get(w.name)
|
||||
if bp == nil {
|
||||
return false
|
||||
}
|
||||
return bp.Contains(addr)
|
||||
return bp.Contains(ctx, addr)
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/go-gost/core/hosts"
|
||||
@ -30,10 +31,10 @@ type hostsWrapper struct {
|
||||
r *hostsRegistry
|
||||
}
|
||||
|
||||
func (w *hostsWrapper) Lookup(network, host string) ([]net.IP, bool) {
|
||||
func (w *hostsWrapper) Lookup(ctx context.Context, network, host string) ([]net.IP, bool) {
|
||||
v := w.r.get(w.name)
|
||||
if v == nil {
|
||||
return nil, false
|
||||
}
|
||||
return v.Lookup(network, host)
|
||||
return v.Lookup(ctx, network, host)
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-gost/core/ingress"
|
||||
)
|
||||
|
||||
@ -28,10 +30,10 @@ type ingressWrapper struct {
|
||||
r *ingressRegistry
|
||||
}
|
||||
|
||||
func (w *ingressWrapper) Get(host string) string {
|
||||
func (w *ingressWrapper) Get(ctx context.Context, host string) string {
|
||||
v := w.r.get(w.name)
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
return v.Get(host)
|
||||
return v.Get(ctx, host)
|
||||
}
|
||||
|
Reference in New Issue
Block a user