上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 53 下一页

2024年7月5日

go解析命令行的3种方式

摘要: 方式1:只用参数值 package main import ( "fmt" "os" ) func main() { // os.Args是[]string for k, v := range os.Args { fmt.Printf("args[%d]=[%s]\n", k, v) } } 方式2 阅读全文

posted @ 2024-07-05 07:15 王景迁 阅读(67) 评论(0) 推荐(0)

2024年7月4日

eBPF bpftool

摘要: bpftool是eBPF的命令行工具,prog和map是最常用的2种方式。 prog # 查看系统中所有的BPF Prog bpftool prog list # 查看tracelog bpftool prog tracelog map # 查看系统中所有的BPF Map bpftool map l 阅读全文

posted @ 2024-07-04 08:37 王景迁 阅读(169) 评论(0) 推荐(0)

2024年7月2日

go Error方法优先级高于String方法

摘要: package main import "fmt" type Test string func (t Test) String() string { return "test string" } func (t Test) Error() string { return "test error" } 阅读全文

posted @ 2024-07-02 08:16 王景迁 阅读(12) 评论(0) 推荐(0)

2024年6月29日

Linux veth口名字不能超过15个字符

摘要: ip link add name aaaaaaaaaaaaaaa type veth peer name bbbbbbbbbbbbbbb ip link add name aaaaaaaaaaaaaaaa type veth peer name bbbbbbbbbbbbbbbb veth口名字15个 阅读全文

posted @ 2024-06-29 17:50 王景迁 阅读(19) 评论(0) 推荐(0)

监听ctrl+c和15信号

摘要: function quit() { time=$(date "+%Y-%m-%d %H:%M:%S") echo "$time quit" exit 0 } # 捕捉ctrl+c trap quit SIGINT # 捕捉15 trap quit SIGTERM while true do slee 阅读全文

posted @ 2024-06-29 17:44 王景迁 阅读(17) 评论(0) 推荐(0)

go defer读不到最新error

摘要: package main import ( "errors" "fmt" ) func main() { err := errors.New("err1") defer fmt.Println(err.Error()) err = errors.New("err2") } defer只会记住执行到此 阅读全文

posted @ 2024-06-29 17:22 王景迁 阅读(11) 评论(0) 推荐(0)

go本地unix socket

摘要: common.go package common const ( SocketPath = "/run/test.sock" ) type Request struct { Age int `json:"age"` } type Response struct { Err string `json: 阅读全文

posted @ 2024-06-29 17:14 王景迁 阅读(61) 评论(0) 推荐(0)

2024年6月27日

docker的3种网络代理配置

摘要: dockerd代理 docker pull由守护进程dockerd执行,代理配置dockerd中。 mkdir -p /etc/systemd/system/docker.service.d vim /etc/systemd/system/docker.service.d/proxy.conf [S 阅读全文

posted @ 2024-06-27 08:48 王景迁 阅读(397) 评论(0) 推荐(0)

2024年6月19日

k8s job类型pod完成后状态

摘要: apiVersion: batch/v1 kind: Job metadata: name: test spec: template: metadata: name: test spec: containers: - name: test image: busybox:1.35.0 restartP 阅读全文

posted @ 2024-06-19 09:03 王景迁 阅读(20) 评论(0) 推荐(0)

2024年6月11日

eBPF内存操作

摘要: 基于LLVM内置函数来操作内存 #ifndef memmove #define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) #endif #ifndef memset #define memset(dest, chr, n) 阅读全文

posted @ 2024-06-11 08:46 王景迁 阅读(31) 评论(0) 推荐(0)

上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 53 下一页

导航