Com

package
v0.0.0-...-7685a06 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: GPL-3.0 Imports: 20 Imported by: 6

Documentation

Index

Constants

View Source
const (
	SoOriginalDst    = 80
	Ip6SoOriginalDst = 80 // from linux/include/uapi/linux/netfilter_ipv6/ip6_tables.h

	ConfigPath = "deepin-proxy"
)

Variables

This section is empty.

Functions

func CloseBlockListener

func CloseBlockListener(listener net.Listener) error

fd may block if add to file, set as non block then close

func GetConfigDir

func GetConfigDir() (string, error)

get home dir

func GetProcStartTime

func GetProcStartTime(pid uint32) (uint64, error)

get start time from /proc/pid/stat

func GetTcpRemoteAddr

func GetTcpRemoteAddr(conn *net.TCPConn) (*net.TCPAddr, error)

get origin destination addr

func GuaranteeDir

func GuaranteeDir(path string) error

make sure dir exist

func IsPid

func IsPid(pid string) bool

func MarshalJson

func MarshalJson(v interface{}) (string, error)

marshal json

func MarshalPackage

func MarshalPackage(pkg DataPackage, proto string) []byte

marshal data, now only useful for udp

func MegaAdd

func MegaAdd(src interface{}, tgt interface{}) (interface{}, bool, error)

use to mega add elem to slice and map result add err

func MegaDel

func MegaDel(src interface{}, tgt interface{}) (interface{}, bool, error)

use to mega del elem from slice and map result del err

func MegaDial

func MegaDial(network string, lAddr net.Addr, rAddr net.Addr) (net.Conn, error)

mega dial try to transparent connect, privilege should be needed

func MegaExist

func MegaExist(src interface{}, tgt interface{}) bool

check if target exist in slice

func MegaInsert

func MegaInsert(src interface{}, tgt interface{}, index int) (interface{}, bool, error)

mega insert elem to slice

func ParseCGroup2FromBuf

func ParseCGroup2FromBuf(in []byte) string

parse cgroup v2 message from /proc/pid/cgroup

func ParsePPidFromBuf

func ParsePPidFromBuf(in []byte) string

parse

func PromotePrivilege

func PromotePrivilege(actionId string, uid uint32, pid uint32, time uint64) error

func RunScript

func RunScript(path string, params []string) ([]byte, error)

run script

func SetConnOptTrn

func SetConnOptTrn(conn net.Conn) error

set conn opt transparent

func SetSockOptTrn

func SetSockOptTrn(fd int) error

set socket transparent

Types

type BaseAddr

type BaseAddr struct {
	IP   net.IP
	Port int
}

addr type for udp and tcp

func ParseRemoteAddrFromMsgHdr

func ParseRemoteAddrFromMsgHdr(buf []byte) (*BaseAddr, error)

ParseRemoteAddrFromMsgHdr parse origin remote addr msg from msg_hdr

type DataPackage

type DataPackage struct {
	Addr net.Addr
	Data []byte
}

func UnMarshalPackage

func UnMarshalPackage(msg []byte) DataPackage

unmarshal data

Jump to

Keyboard shortcuts

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