iplookup

package
v0.0.0-...-aba53e5 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 9 Imported by: 0

README

iplookup

This filter implements a generic ip lookup method using the package geoiplookup. All lookups are done using gRPC to another server (either locally or remote) that has implemented any geoiplookup server.

{
  "filter": [
    {
      "type": "iplookup",
      "server": "localhost:8081",
      "timeout": 2000,
      "ip_field": "message",
      "key": "iplocation",
      "skip_private": true,
      "private_net": [
        "172.16.0.0/12"
      ]
    }
  ]
}

Private nets are skipped by default, and all private IPv4 and IPv6 are included in the default list. Timeout is the time to wait for an answer in milliseconds, default is 2 sec.

Documentation

Index

Constants

View Source
const ErrorTag = "iplookup_error"

ErrorTag tag added to event when process module failed

View Source
const ModuleName = "iplookup"

ModuleName is the name used in config file

Variables

This section is empty.

Functions

func InitHandler

func InitHandler(ctx context.Context, raw config.ConfigRaw, control config.Control) (config.TypeFilterConfig, error)

InitHandler initialize the filter plugin

Types

type FilterConfig

type FilterConfig struct {
	config.FilterConfig
	Server      string   `json:"server" yaml:"server"`             // server to connect to
	Timeout     uint     `json:"timeout" yaml:"timeout"`           // timeout in milliseconds
	Key         string   `json:"key" yaml:"key"`                   // field to save the result to
	IPField     string   `json:"ip_field" yaml:"ip_field"`         // IP field to get ip address from
	SkipPrivate bool     `json:"skip_private" yaml:"skip_private"` // skip private IP addresses
	PrivateNet  []string `json:"private_net" yaml:"private_net"`   // list of own defined private IP addresses
	// contains filtered or unexported fields
}

FilterConfig holds the configuration json fields and internal objects

func DefaultFilterConfig

func DefaultFilterConfig() FilterConfig

DefaultFilterConfig returns an FilterConfig struct with default values

func (*FilterConfig) Event

Event the main filter event

Jump to

Keyboard shortcuts

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