net

package
v0.0.0-...-1239505 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: GPL-2.0-only

Index

Constants

View Source
const (
	StatusDisable = 0
	StatusEnable  = 1
)
View Source
const (
	StatusEventUnread = 0
	StatusEventRead   = 1
)

Variables

View Source
var (
	ErrorEnable         = errors.New("net protection enable failed")
	ErrorDisable        = errors.New("net protection disable failed")
	ErrorClearPolicy    = errors.New("clear net policy failed")
	ErrorPolicyNotExist = errors.New("net policy does not exist")
)

Functions

func AddPolicy

func AddPolicy(policy Policy) bool

func ClearPolicy

func ClearPolicy() bool

func DeletePolicy

func DeletePolicy(id int) bool

func Disable

func Disable() bool

func Enable

func Enable() bool

Types

type Event

type Event struct {
	ID        int64  `json:"id"`
	Protocol  int    `json:"protocol"`
	SrcAddr   string `json:"saddr"`
	DstAddr   string `json:"daddr"`
	SrcPort   int    `json:"sport"`
	DstPort   int    `json:"dport"`
	Timestamp int64  `json:"timestamp"`
	Policy    int64  `json:"policy"`
	Status    int    `json:"status"`
}

type Policy

type Policy struct {
	ID       int64 `json:"id"`
	Priority int8  `json:"priority"`
	Addr     struct {
		Src struct {
			Begin string `json:"begin"`
			End   string `json:"end"`
		} `json:"src"`
		Dst struct {
			Begin string `json:"begin"`
			End   string `json:"end"`
		} `json:"dst"`
	} `json:"addr"`
	Protocol struct {
		Begin uint8 `json:"begin"`
		End   uint8 `json:"end"`
	} `json:"protocol"`
	Port struct {
		Src struct {
			Begin uint16 `json:"begin"`
			End   uint16 `json:"end"`
		} `json:"src"`
		Dst struct {
			Begin uint16 `json:"begin"`
			End   uint16 `json:"end"`
		} `json:"dst"`
	} `json:"port"`
	Flags    int32  `json:"flags"`
	Response uint32 `json:"response"`
}

Jump to

Keyboard shortcuts

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