action

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package action defines a set of common argument structures. This is used so that we can more easily share functionality between the multiple different interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author added in v0.1.8

type Author string

Author defines who initiated the request

func (Author) SID64 added in v0.1.8

func (a Author) SID64() (steamid.SID64, error)

type BanASNRequest added in v0.1.8

type BanASNRequest struct {
	BaseOrigin
	Target
	Author
	Duration
	ASNum  int64
	Reason string
}

func NewBanASN added in v0.1.8

func NewBanASN(o model.Origin, target string, author string, reason string, duration string, asNum int64) BanASNRequest

type BanNetRequest

type BanNetRequest struct {
	BaseOrigin
	Target
	Author
	Duration
	CIDR   string
	Reason string
}

func NewBanNet

func NewBanNet(o model.Origin, target string, author string, reason string, duration string, cidr string) BanNetRequest

type BanRequest

type BanRequest struct {
	BaseOrigin
	Target
	Author
	Duration
	Reason  string
	BanType model.BanType
}

func NewBan

func NewBan(o model.Origin, target string, author string, reason string, duration string) BanRequest

func NewMute

func NewMute(o model.Origin, target string, author string, reason string, duration string) BanRequest

type BaseOrigin added in v0.1.8

type BaseOrigin struct {
	Origin model.Origin
}

BaseOrigin defines the base struct for all actions. It just marks where the event originated.

type CSayRequest

type CSayRequest SayRequest

func NewCSay

func NewCSay(o model.Origin, server string, message string) CSayRequest

type Duration

type Duration string

Duration defines the length of time the action should be valid for A duration of 0 will be interpreted as permanent and set to 10 years in the future

func (Duration) Value

func (d Duration) Value() (time.Duration, error)

type Executor added in v0.1.8

type Executor interface {
	Find(playerStr string, ip string, pi *model.PlayerInfo) error
	FindPlayerByCIDR(ipNet *net.IPNet, pi *model.PlayerInfo) error
	PersonBySID(sid steamid.SID64, ipAddr string, p *model.Person) error
	GetOrCreateProfileBySteamID(ctx context.Context, sid steamid.SID64, ipAddr string, p *model.Person) error
	Ban(args BanRequest, b *model.Ban) error
	BanNetwork(args BanNetRequest, net *model.BanNet) error
	BanASN(args BanASNRequest, net *model.BanASN) error
	Unban(args UnbanRequest) (bool, error)
	UnbanASN(ctx context.Context, args UnbanASNRequest) (bool, error)
	Kick(args KickRequest, pi *model.PlayerInfo) error
	Say(args SayRequest) error
	CSay(args CSayRequest) error
	PSay(args PSayRequest) error
	ResolveSID(sidStr string) (steamid.SID64, error)
	SetSteam(args SetSteamIDRequest) (bool, error)
	ServerState() model.ServerStateCollection
	ContainsFilteredWord(body string) (bool, model.Filter)
	FilterDel(ctx context.Context, args FilterDelRequest) (bool, error)
	FilterAdd(args FilterAddRequest) (model.Filter, error)
	FilterCheck(args FilterCheckRequest) []model.Filter
}

Executor implements the common interface for the core application functionality. Its currently implemented like this so that we can avoid cyclic dependency issues. This is a strong candidate for a better refactor. The secondary purpose is to allow a common interface for executing action logic in a common manner from multiple different interfaces, such as web and discord.

type FilterAddRequest

type FilterAddRequest struct {
	BaseOrigin
	Author
	Filter string
}

func NewFilterAdd

func NewFilterAdd(o model.Origin, filter string) FilterAddRequest

type FilterCheckRequest

type FilterCheckRequest struct {
	BaseOrigin
	Author
	Message string
}

func NewFilterCheck

func NewFilterCheck(o model.Origin, message string) FilterCheckRequest

type FilterDelRequest

type FilterDelRequest struct {
	BaseOrigin
	Author
	FilterID int
}

func NewFilterDel

func NewFilterDel(o model.Origin, filterID int) FilterDelRequest

type FindCIDRRequest

type FindCIDRRequest struct {
	BaseOrigin
	CIDR *net.IPNet
}

func NewFindByCIDR

func NewFindByCIDR(o model.Origin, cidr *net.IPNet) FindCIDRRequest

type FindRequest

type FindRequest struct {
	BaseOrigin
	Query string
}

func NewFind

func NewFind(o model.Origin, q string) FindRequest

type GetASNRecordRequest

type GetASNRecordRequest struct {
	BaseOrigin
	IPAddr string
}

func NewGetASNRecord

func NewGetASNRecord(o model.Origin, ipAddr string) GetASNRecordRequest

type GetBanNetRequest

type GetBanNetRequest GetBanRequest

func NewGetBanNet

func NewGetBanNet(o model.Origin, target string) GetBanNetRequest

type GetBanRequest

type GetBanRequest struct {
	BaseOrigin
	Target
}

func NewGetBan

func NewGetBan(o model.Origin, target string) GetBanRequest

type GetChatHistoryRequest

type GetChatHistoryRequest struct {
	BaseOrigin
	Target
	Page int
}

func NewGetChatHistory

func NewGetChatHistory(o model.Origin, target string, page int) GetChatHistoryRequest

type GetHistoryChatRequest

type GetHistoryChatRequest GetHistoryIPRequest

func NewGetHistoryChat

func NewGetHistoryChat(o model.Origin, target string) GetHistoryChatRequest

type GetHistoryIPRequest

type GetHistoryIPRequest struct {
	BaseOrigin
	Author
	Target
}

func NewGetHistoryIP

func NewGetHistoryIP(o model.Origin, target string) GetHistoryIPRequest

type GetLocationRecordRequest

type GetLocationRecordRequest GetASNRecordRequest

func NewGetLocationRecord

func NewGetLocationRecord(o model.Origin, ipAddr string) GetLocationRecordRequest

type GetOrCreatePersonByIDRequest

type GetOrCreatePersonByIDRequest struct {
	BaseOrigin
	Target
	IPAddr string
}

func NewGetOrCreatePersonByID

func NewGetOrCreatePersonByID(o model.Origin, target string, ipAddr string) GetOrCreatePersonByIDRequest

type GetOrCreateProfileBySteamIDRequest

type GetOrCreateProfileBySteamIDRequest GetOrCreatePersonByIDRequest

func NewGetOrCreateProfileBySteamID

func NewGetOrCreateProfileBySteamID(o model.Origin, target string, ipAddr string) GetOrCreateProfileBySteamIDRequest

type GetPersonByIDRequest

type GetPersonByIDRequest GetBanRequest

func NewGetPersonByID

func NewGetPersonByID(o model.Origin, target string) GetPersonByIDRequest

type GetProxyRecordRequest

type GetProxyRecordRequest GetASNRecordRequest

func NewGetProxyRecord

func NewGetProxyRecord(o model.Origin, ipAddr string) GetProxyRecordRequest

type KickRequest

type KickRequest struct {
	BaseOrigin
	Target
	Author
	Reason string
}

func NewKick

func NewKick(o model.Origin, target string, author string, reason string) KickRequest

type MuteRequest

type MuteRequest BanRequest

type PSayRequest

type PSayRequest struct {
	BaseOrigin
	Author
	Target
	Message string
}

func NewPSay

func NewPSay(o model.Origin, target string, message string) PSayRequest

type ProfileRequest

type ProfileRequest struct {
	BaseOrigin
	Target
	IPAddr string
}

type SayRequest

type SayRequest struct {
	BaseOrigin
	Author
	Server  string
	Message string
}

func NewSay

func NewSay(o model.Origin, server string, message string) SayRequest

type ServerByNameRequest

type ServerByNameRequest struct {
	BaseOrigin
	ServerName string
}

func NewServerByName

func NewServerByName(o model.Origin, serverID string) ServerByNameRequest

type SetSteamIDRequest

type SetSteamIDRequest struct {
	BaseOrigin
	Target
	DiscordID string
}

func NewSetSteamID

func NewSetSteamID(o model.Origin, target string, discordID string) SetSteamIDRequest

type Target

type Target string

Target defines who the request is being made against

func (Target) SID64

func (t Target) SID64() (steamid.SID64, error)

type UnbanASNRequest added in v0.1.8

type UnbanASNRequest struct {
	BaseOrigin
	ASNum  string
	Reason string
}

type UnbanRequest

type UnbanRequest KickRequest

func NewUnban

func NewUnban(o model.Origin, target string, author string, reason string) UnbanRequest

Jump to

Keyboard shortcuts

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