mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-28 13:49:19 +07:00
feat: add config_parser
This commit is contained in:
@ -20,8 +20,6 @@ const (
|
||||
BigEndianTproxyPortKey
|
||||
DisableL4TxChecksumKey
|
||||
DisableL4RxChecksumKey
|
||||
EpochKey
|
||||
RoutingsLenKey
|
||||
)
|
||||
|
||||
type DisableL4ChecksumPolicy uint32
|
||||
@ -50,6 +48,7 @@ type OutboundIndex uint8
|
||||
|
||||
const (
|
||||
OutboundDirect OutboundIndex = 0
|
||||
OutboundBlock OutboundIndex = 1
|
||||
OutboundControlPlaneDirect OutboundIndex = 0xFE
|
||||
OutboundLogicalAnd OutboundIndex = 0xFF
|
||||
)
|
||||
@ -58,6 +57,8 @@ func (i OutboundIndex) String() string {
|
||||
switch i {
|
||||
case OutboundDirect:
|
||||
return "direct"
|
||||
case OutboundBlock:
|
||||
return "block"
|
||||
case OutboundControlPlaneDirect:
|
||||
return "<Control Plane Direct>"
|
||||
case OutboundLogicalAnd:
|
||||
|
@ -19,4 +19,6 @@ const (
|
||||
Function_Mac = "mac"
|
||||
Function_L4Proto = "l4proto"
|
||||
Function_IpVersion = "ipversion"
|
||||
|
||||
Declaration_Final = "final"
|
||||
)
|
||||
|
28
common/debug.go
Normal file
28
common/debug.go
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* Copyright (c) since 2023, mzz2017 (mzz@tuta.io). All rights reserved.
|
||||
*/
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ReportMemory(tag string) {
|
||||
if !logrus.IsLevelEnabled(logrus.DebugLevel) {
|
||||
return
|
||||
}
|
||||
b, err := os.ReadFile(filepath.Join("/proc", strconv.Itoa(os.Getpid()), "status"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
str := strings.TrimSpace(string(b))
|
||||
_, after, _ := strings.Cut(str, "VmHWM:")
|
||||
usage, _, _ := strings.Cut(after, "\n")
|
||||
logrus.Debugln(tag+": memory usage:", strings.TrimSpace(usage))
|
||||
}
|
Reference in New Issue
Block a user