protocol

package
v0.0.0-...-62bb9e5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: GPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Action_name = map[int32]string{
	0:  "NONE",
	1:  "LOAD_FIREWALL",
	2:  "UNLOAD_FIREWALL",
	3:  "CHANGE_CONFIG",
	4:  "ENABLE_RULE",
	5:  "DISABLE_RULE",
	6:  "DELETE_RULE",
	7:  "CHANGE_RULE",
	8:  "LOG_LEVEL",
	9:  "STOP",
	10: "MONITOR_PROCESS",
	11: "STOP_MONITOR_PROCESS",
}
View Source
var Action_value = map[string]int32{
	"NONE":                 0,
	"LOAD_FIREWALL":        1,
	"UNLOAD_FIREWALL":      2,
	"CHANGE_CONFIG":        3,
	"ENABLE_RULE":          4,
	"DISABLE_RULE":         5,
	"DELETE_RULE":          6,
	"CHANGE_RULE":          7,
	"LOG_LEVEL":            8,
	"STOP":                 9,
	"MONITOR_PROCESS":      10,
	"STOP_MONITOR_PROCESS": 11,
}
View Source
var NotificationReplyCode_name = map[int32]string{
	0: "OK",
	1: "ERROR",
}
View Source
var NotificationReplyCode_value = map[string]int32{
	"OK":    0,
	"ERROR": 1,
}

Functions

func RegisterUIServer

func RegisterUIServer(s *grpc.Server, srv UIServer)

Types

type Action

type Action int32
const (
	Action_NONE                 Action = 0
	Action_LOAD_FIREWALL        Action = 1
	Action_UNLOAD_FIREWALL      Action = 2
	Action_CHANGE_CONFIG        Action = 3
	Action_ENABLE_RULE          Action = 4
	Action_DISABLE_RULE         Action = 5
	Action_DELETE_RULE          Action = 6
	Action_CHANGE_RULE          Action = 7
	Action_LOG_LEVEL            Action = 8
	Action_STOP                 Action = 9
	Action_MONITOR_PROCESS      Action = 10
	Action_STOP_MONITOR_PROCESS Action = 11
)

func (Action) EnumDescriptor

func (Action) EnumDescriptor() ([]byte, []int)

func (Action) String

func (x Action) String() string

type ClientConfig

type ClientConfig struct {
	Id                uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name              string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Version           string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
	IsFirewallRunning bool   `protobuf:"varint,4,opt,name=isFirewallRunning,proto3" json:"isFirewallRunning,omitempty"`
	// daemon configuration as json string
	Config   string  `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"`
	LogLevel uint32  `protobuf:"varint,6,opt,name=logLevel,proto3" json:"logLevel,omitempty"`
	Rules    []*Rule `protobuf:"bytes,7,rep,name=rules,proto3" json:"rules,omitempty"`
}

client configuration sent on Subscribe()

func (*ClientConfig) Descriptor

func (*ClientConfig) Descriptor() ([]byte, []int)

func (*ClientConfig) GetConfig

func (m *ClientConfig) GetConfig() string

func (*ClientConfig) GetId

func (m *ClientConfig) GetId() uint64

func (*ClientConfig) GetIsFirewallRunning

func (m *ClientConfig) GetIsFirewallRunning() bool

func (*ClientConfig) GetLogLevel

func (m *ClientConfig) GetLogLevel() uint32

func (*ClientConfig) GetName

func (m *ClientConfig) GetName() string

func (*ClientConfig) GetRules

func (m *ClientConfig) GetRules() []*Rule

func (*ClientConfig) GetVersion

func (m *ClientConfig) GetVersion() string

func (*ClientConfig) ProtoMessage

func (*ClientConfig) ProtoMessage()

func (*ClientConfig) Reset

func (m *ClientConfig) Reset()

func (*ClientConfig) String

func (m *ClientConfig) String() string

type Connection

type Connection struct {
	Protocol    string            `protobuf:"bytes,1,opt,name=protocol,proto3" json:"protocol,omitempty"`
	SrcIp       string            `protobuf:"bytes,2,opt,name=src_ip,json=srcIp,proto3" json:"src_ip,omitempty"`
	SrcPort     uint32            `protobuf:"varint,3,opt,name=src_port,json=srcPort,proto3" json:"src_port,omitempty"`
	DstIp       string            `protobuf:"bytes,4,opt,name=dst_ip,json=dstIp,proto3" json:"dst_ip,omitempty"`
	DstHost     string            `protobuf:"bytes,5,opt,name=dst_host,json=dstHost,proto3" json:"dst_host,omitempty"`
	DstPort     uint32            `protobuf:"varint,6,opt,name=dst_port,json=dstPort,proto3" json:"dst_port,omitempty"`
	UserId      uint32            `protobuf:"varint,7,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	ProcessId   uint32            `protobuf:"varint,8,opt,name=process_id,json=processId,proto3" json:"process_id,omitempty"`
	ProcessPath string            `protobuf:"bytes,9,opt,name=process_path,json=processPath,proto3" json:"process_path,omitempty"`
	ProcessCwd  string            `protobuf:"bytes,10,opt,name=process_cwd,json=processCwd,proto3" json:"process_cwd,omitempty"`
	ProcessArgs []string          `protobuf:"bytes,11,rep,name=process_args,json=processArgs,proto3" json:"process_args,omitempty"`
	ProcessEnv  map[string]string `` /* 180-byte string literal not displayed */
}

func (*Connection) Descriptor

func (*Connection) Descriptor() ([]byte, []int)

func (*Connection) GetDstHost

func (m *Connection) GetDstHost() string

func (*Connection) GetDstIp

func (m *Connection) GetDstIp() string

func (*Connection) GetDstPort

func (m *Connection) GetDstPort() uint32

func (*Connection) GetProcessArgs

func (m *Connection) GetProcessArgs() []string

func (*Connection) GetProcessCwd

func (m *Connection) GetProcessCwd() string

func (*Connection) GetProcessEnv

func (m *Connection) GetProcessEnv() map[string]string

func (*Connection) GetProcessId

func (m *Connection) GetProcessId() uint32

func (*Connection) GetProcessPath

func (m *Connection) GetProcessPath() string

func (*Connection) GetProtocol

func (m *Connection) GetProtocol() string

func (*Connection) GetSrcIp

func (m *Connection) GetSrcIp() string

func (*Connection) GetSrcPort

func (m *Connection) GetSrcPort() uint32

func (*Connection) GetUserId

func (m *Connection) GetUserId() uint32

func (*Connection) ProtoMessage

func (*Connection) ProtoMessage()

func (*Connection) Reset

func (m *Connection) Reset()

func (*Connection) String

func (m *Connection) String() string

type Event

type Event struct {
	Time       string      `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
	Connection *Connection `protobuf:"bytes,2,opt,name=connection,proto3" json:"connection,omitempty"`
	Rule       *Rule       `protobuf:"bytes,3,opt,name=rule,proto3" json:"rule,omitempty"`
}

func (*Event) Descriptor

func (*Event) Descriptor() ([]byte, []int)

func (*Event) GetConnection

func (m *Event) GetConnection() *Connection

func (*Event) GetRule

func (m *Event) GetRule() *Rule

func (*Event) GetTime

func (m *Event) GetTime() string

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) Reset

func (m *Event) Reset()

func (*Event) String

func (m *Event) String() string

type Notification

type Notification struct {
	Id         uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	ClientName string `protobuf:"bytes,2,opt,name=clientName,proto3" json:"clientName,omitempty"`
	ServerName string `protobuf:"bytes,3,opt,name=serverName,proto3" json:"serverName,omitempty"`
	// CHANGE_CONFIG: 2, data: {"default_timeout": 1, ...}
	Type  Action  `protobuf:"varint,4,opt,name=type,proto3,enum=protocol.Action" json:"type,omitempty"`
	Data  string  `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
	Rules []*Rule `protobuf:"bytes,6,rep,name=rules,proto3" json:"rules,omitempty"`
}

notification sent to the clients (daemons)

func (*Notification) Descriptor

func (*Notification) Descriptor() ([]byte, []int)

func (*Notification) GetClientName

func (m *Notification) GetClientName() string

func (*Notification) GetData

func (m *Notification) GetData() string

func (*Notification) GetId

func (m *Notification) GetId() uint64

func (*Notification) GetRules

func (m *Notification) GetRules() []*Rule

func (*Notification) GetServerName

func (m *Notification) GetServerName() string

func (*Notification) GetType

func (m *Notification) GetType() Action

func (*Notification) ProtoMessage

func (*Notification) ProtoMessage()

func (*Notification) Reset

func (m *Notification) Reset()

func (*Notification) String

func (m *Notification) String() string

type NotificationReply

type NotificationReply struct {
	Id   uint64                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Code NotificationReplyCode `protobuf:"varint,2,opt,name=code,proto3,enum=protocol.NotificationReplyCode" json:"code,omitempty"`
	Data string                `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}

notification reply sent to the server (GUI)

func (*NotificationReply) Descriptor

func (*NotificationReply) Descriptor() ([]byte, []int)

func (*NotificationReply) GetCode

func (*NotificationReply) GetData

func (m *NotificationReply) GetData() string

func (*NotificationReply) GetId

func (m *NotificationReply) GetId() uint64

func (*NotificationReply) ProtoMessage

func (*NotificationReply) ProtoMessage()

func (*NotificationReply) Reset

func (m *NotificationReply) Reset()

func (*NotificationReply) String

func (m *NotificationReply) String() string

type NotificationReplyCode

type NotificationReplyCode int32
const (
	NotificationReplyCode_OK    NotificationReplyCode = 0
	NotificationReplyCode_ERROR NotificationReplyCode = 1
)

func (NotificationReplyCode) EnumDescriptor

func (NotificationReplyCode) EnumDescriptor() ([]byte, []int)

func (NotificationReplyCode) String

func (x NotificationReplyCode) String() string

type Operator

type Operator struct {
	Type      string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Operand   string `protobuf:"bytes,2,opt,name=operand,proto3" json:"operand,omitempty"`
	Data      string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	Sensitive bool   `protobuf:"varint,4,opt,name=sensitive,proto3" json:"sensitive,omitempty"`
}

func (*Operator) Descriptor

func (*Operator) Descriptor() ([]byte, []int)

func (*Operator) GetData

func (m *Operator) GetData() string

func (*Operator) GetOperand

func (m *Operator) GetOperand() string

func (*Operator) GetSensitive

func (m *Operator) GetSensitive() bool

func (*Operator) GetType

func (m *Operator) GetType() string

func (*Operator) ProtoMessage

func (*Operator) ProtoMessage()

func (*Operator) Reset

func (m *Operator) Reset()

func (*Operator) String

func (m *Operator) String() string

type PingReply

type PingReply struct {
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}

func (*PingReply) Descriptor

func (*PingReply) Descriptor() ([]byte, []int)

func (*PingReply) GetId

func (m *PingReply) GetId() uint64

func (*PingReply) ProtoMessage

func (*PingReply) ProtoMessage()

func (*PingReply) Reset

func (m *PingReply) Reset()

func (*PingReply) String

func (m *PingReply) String() string

type PingRequest

type PingRequest struct {
	Id    uint64      `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Stats *Statistics `protobuf:"bytes,2,opt,name=stats,proto3" json:"stats,omitempty"`
}

func (*PingRequest) Descriptor

func (*PingRequest) Descriptor() ([]byte, []int)

func (*PingRequest) GetId

func (m *PingRequest) GetId() uint64

func (*PingRequest) GetStats

func (m *PingRequest) GetStats() *Statistics

func (*PingRequest) ProtoMessage

func (*PingRequest) ProtoMessage()

func (*PingRequest) Reset

func (m *PingRequest) Reset()

func (*PingRequest) String

func (m *PingRequest) String() string

type Rule

type Rule struct {
	Name       string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Enabled    bool      `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"`
	Precedence bool      `protobuf:"varint,3,opt,name=precedence,proto3" json:"precedence,omitempty"`
	Action     string    `protobuf:"bytes,4,opt,name=action,proto3" json:"action,omitempty"`
	Duration   string    `protobuf:"bytes,5,opt,name=duration,proto3" json:"duration,omitempty"`
	Operator   *Operator `protobuf:"bytes,6,opt,name=operator,proto3" json:"operator,omitempty"`
}

func (*Rule) Descriptor

func (*Rule) Descriptor() ([]byte, []int)

func (*Rule) GetAction

func (m *Rule) GetAction() string

func (*Rule) GetDuration

func (m *Rule) GetDuration() string

func (*Rule) GetEnabled

func (m *Rule) GetEnabled() bool

func (*Rule) GetName

func (m *Rule) GetName() string

func (*Rule) GetOperator

func (m *Rule) GetOperator() *Operator

func (*Rule) GetPrecedence

func (m *Rule) GetPrecedence() bool

func (*Rule) ProtoMessage

func (*Rule) ProtoMessage()

func (*Rule) Reset

func (m *Rule) Reset()

func (*Rule) String

func (m *Rule) String() string

type Statistics

type Statistics struct {
	DaemonVersion string            `protobuf:"bytes,1,opt,name=daemon_version,json=daemonVersion,proto3" json:"daemon_version,omitempty"`
	Rules         uint64            `protobuf:"varint,2,opt,name=rules,proto3" json:"rules,omitempty"`
	Uptime        uint64            `protobuf:"varint,3,opt,name=uptime,proto3" json:"uptime,omitempty"`
	DnsResponses  uint64            `protobuf:"varint,4,opt,name=dns_responses,json=dnsResponses,proto3" json:"dns_responses,omitempty"`
	Connections   uint64            `protobuf:"varint,5,opt,name=connections,proto3" json:"connections,omitempty"`
	Ignored       uint64            `protobuf:"varint,6,opt,name=ignored,proto3" json:"ignored,omitempty"`
	Accepted      uint64            `protobuf:"varint,7,opt,name=accepted,proto3" json:"accepted,omitempty"`
	Dropped       uint64            `protobuf:"varint,8,opt,name=dropped,proto3" json:"dropped,omitempty"`
	RuleHits      uint64            `protobuf:"varint,9,opt,name=rule_hits,json=ruleHits,proto3" json:"rule_hits,omitempty"`
	RuleMisses    uint64            `protobuf:"varint,10,opt,name=rule_misses,json=ruleMisses,proto3" json:"rule_misses,omitempty"`
	ByProto       map[string]uint64 `` /* 172-byte string literal not displayed */
	ByAddress     map[string]uint64 `` /* 178-byte string literal not displayed */
	ByHost        map[string]uint64 `` /* 169-byte string literal not displayed */
	ByPort        map[string]uint64 `` /* 169-byte string literal not displayed */
	ByUid         map[string]uint64 `` /* 166-byte string literal not displayed */
	ByExecutable  map[string]uint64 `` /* 187-byte string literal not displayed */
	Events        []*Event          `protobuf:"bytes,17,rep,name=events,proto3" json:"events,omitempty"`
}

func (*Statistics) Descriptor

func (*Statistics) Descriptor() ([]byte, []int)

func (*Statistics) GetAccepted

func (m *Statistics) GetAccepted() uint64

func (*Statistics) GetByAddress

func (m *Statistics) GetByAddress() map[string]uint64

func (*Statistics) GetByExecutable

func (m *Statistics) GetByExecutable() map[string]uint64

func (*Statistics) GetByHost

func (m *Statistics) GetByHost() map[string]uint64

func (*Statistics) GetByPort

func (m *Statistics) GetByPort() map[string]uint64

func (*Statistics) GetByProto

func (m *Statistics) GetByProto() map[string]uint64

func (*Statistics) GetByUid

func (m *Statistics) GetByUid() map[string]uint64

func (*Statistics) GetConnections

func (m *Statistics) GetConnections() uint64

func (*Statistics) GetDaemonVersion

func (m *Statistics) GetDaemonVersion() string

func (*Statistics) GetDnsResponses

func (m *Statistics) GetDnsResponses() uint64

func (*Statistics) GetDropped

func (m *Statistics) GetDropped() uint64

func (*Statistics) GetEvents

func (m *Statistics) GetEvents() []*Event

func (*Statistics) GetIgnored

func (m *Statistics) GetIgnored() uint64

func (*Statistics) GetRuleHits

func (m *Statistics) GetRuleHits() uint64

func (*Statistics) GetRuleMisses

func (m *Statistics) GetRuleMisses() uint64

func (*Statistics) GetRules

func (m *Statistics) GetRules() uint64

func (*Statistics) GetUptime

func (m *Statistics) GetUptime() uint64

func (*Statistics) ProtoMessage

func (*Statistics) ProtoMessage()

func (*Statistics) Reset

func (m *Statistics) Reset()

func (*Statistics) String

func (m *Statistics) String() string

type UIClient

type UIClient interface {
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingReply, error)
	AskRule(ctx context.Context, in *Connection, opts ...grpc.CallOption) (*Rule, error)
	Subscribe(ctx context.Context, in *ClientConfig, opts ...grpc.CallOption) (*ClientConfig, error)
	Notifications(ctx context.Context, opts ...grpc.CallOption) (UI_NotificationsClient, error)
}

UIClient is the client API for UI service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewUIClient

func NewUIClient(cc *grpc.ClientConn) UIClient

type UIServer

type UIServer interface {
	Ping(context.Context, *PingRequest) (*PingReply, error)
	AskRule(context.Context, *Connection) (*Rule, error)
	Subscribe(context.Context, *ClientConfig) (*ClientConfig, error)
	Notifications(UI_NotificationsServer) error
}

UIServer is the server API for UI service.

type UI_NotificationsClient

type UI_NotificationsClient interface {
	Send(*NotificationReply) error
	Recv() (*Notification, error)
	grpc.ClientStream
}

type UI_NotificationsServer

type UI_NotificationsServer interface {
	Send(*Notification) error
	Recv() (*NotificationReply, error)
	grpc.ServerStream
}

type UnimplementedUIServer

type UnimplementedUIServer struct {
}

UnimplementedUIServer can be embedded to have forward compatible implementations.

func (*UnimplementedUIServer) AskRule

func (*UnimplementedUIServer) AskRule(ctx context.Context, req *Connection) (*Rule, error)

func (*UnimplementedUIServer) Notifications

func (*UnimplementedUIServer) Ping

func (*UnimplementedUIServer) Subscribe

Jump to

Keyboard shortcuts

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