ipfilter

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

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

View Source
const (
	// PluginName defines the name for an ipfilter plugin
	PluginName = "ipfilter"
)

Variables

View Source
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.

View Source
var PluginMap = map[string]plugin.Plugin{
	PluginName: &Plugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	CheckIP(ip, protocol string) error
	Reload() error
}

Filter defines the interface for ipfilter plugins

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

func (*GRPCServer) Reload

func (s *GRPCServer) Reload(ctx context.Context, req *emptypb.Empty) (*emptypb.Empty, error)

Reload implements the server side reload 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

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer defines the GRPC server implementation for this plugin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL