Documentation ¶
Overview ¶
Package ipfilter defines the interface and the GRPC implementation for IP filter plugins. IP filter plugins allow to allow/deny access based on the IP.
Index ¶
Constants ¶
const (
// PluginName defines the name for an ipfilter plugin
PluginName = "ipfilter"
)
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "SFTPGO_PLUGIN_IPFILTER",
MagicCookieValue: "368dbdab-4839-4bec-b75f-fc74a2d50f24",
}
Handshake is a common handshake that is shared by plugin and host.
var PluginMap = map[string]plugin.Plugin{ PluginName: &Plugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
This section is empty.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is an implementation of IPFilter interface that talks over RPC.
func (*GRPCClient) CheckIP ¶
func (c *GRPCClient) CheckIP(ip, protocol string) error
CheckIP returns an error if the specified IP is not allowed
func (*GRPCClient) Reload ¶
func (c *GRPCClient) Reload() error
Reload instructs the filter to reload its configuration
type GRPCServer ¶
type GRPCServer struct {
Impl Filter
}
GRPCServer defines the gRPC server that GRPCClient talks to.
func (*GRPCServer) CheckIP ¶
func (s *GRPCServer) CheckIP(ctx context.Context, req *proto.CheckIPRequest) (*emptypb.Empty, error)
CheckIP implements the server side check IP method
type Plugin ¶
type Plugin struct { plugin.Plugin Impl Filter }
Plugin defines the implementation to serve/connect to a notifier plugin
func (*Plugin) GRPCClient ¶
func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient defines the GRPC client implementation for this plugin