上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 69 下一页

2025年1月6日

Linux tso和gso

摘要: tso全名是tcp-segmentation-offload,主机网卡分段tcp大包。gso全名是generic-segmentation-offload,内核发送到主机网卡前分段tcp大包。只要tso开启,gso自动开启。 tso和gso组合关系 tso开启 内核不分段,主机网卡分段。 tso关闭 阅读全文

posted @ 2025-01-06 08:46 王景迁 阅读(222) 评论(0) 推荐(0)

2024年12月31日

gorm crud总结

摘要: type Student struct { Id int64 `gorm:"primary_key"` Name string `gorm:"column:name"` Age int `gorm:"column:age"` } func (Student) TableName() string { 阅读全文

posted @ 2024-12-31 21:52 王景迁 阅读(44) 评论(0) 推荐(0)

2024年12月30日

go 打印结构体指针数组

摘要: 序列化后输出。 package main import ( "encoding/json" "fmt" ) type Student struct { Age int Name string } func printStructPointerSlice(data interface{}) strin 阅读全文

posted @ 2024-12-30 09:25 王景迁 阅读(37) 评论(0) 推荐(0)

2024年12月28日

client-go InClusterConfig方法

摘要: InClusterConfig方法 package main import ( "context" "test/signals" "time" "os" core_v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1 阅读全文

posted @ 2024-12-28 22:04 王景迁 阅读(57) 评论(0) 推荐(0)

kube-ovn-controller分配pod ip

摘要: kube-ovn v1.10.10 存活pod判断条件 pkg/controller/pod.goisPodAlive函数判断pod是否存活,pod从存活变成死亡后,该ip会分给其他pod。 3种ip分配方式 场景1:正常分配 pkg/ipam/subnet.gogetV4RandomAddress 阅读全文

posted @ 2024-12-28 17:01 王景迁 阅读(44) 评论(0) 推荐(0)

Linux watch命令

摘要: watch用于观察内容变化,后面带要执行的命令。默认每2秒刷新一次。默认一直执行到用户ctrl+c为止,可通过timeout来控制超时时间。 参数含义-n 数字:指定刷新间隔。-d:高亮显示变化部分。 watch -d date 阅读全文

posted @ 2024-12-28 15:40 王景迁 阅读(28) 评论(0) 推荐(0)

2024年12月18日

go 输出栈信息

摘要: 方式1:debug.Stack函数 调用runtime.Stack函数,无需指定参数,输出当前goroutine的栈信息。源码在runtime/debug/stack.go中: func Stack() []byte { buf := make([]byte, 1024) for { n := ru 阅读全文

posted @ 2024-12-18 09:11 王景迁 阅读(50) 评论(0) 推荐(0)

2024年12月14日

gorm访问SQLite

摘要: 场景1:连接db并访问 # 创建数据库表 .open test.db create table student(id int primary key not null, name char(10) not null, age int not null); # 下载go依赖 go get gorm.i 阅读全文

posted @ 2024-12-14 00:35 王景迁 阅读(182) 评论(0) 推荐(0)

2024年12月13日

Linux访问本地SQLite

摘要: SQLite是本地数据库,没有后台进程,一般Linux默认安装了SQLite3。 # 创建数据库和表 # 显示字段名 .headers on # 每个字段占一行 .mode line # 列出所有表名 select name from sqlite_master where type = 'tabl 阅读全文

posted @ 2024-12-13 21:10 王景迁 阅读(38) 评论(0) 推荐(0)

2024年12月3日

traceroute原理和问题

摘要: traceroute [ip地址],表示路由追踪该ip,结果出现星号表示没有正常获取到响应。 客户端每次发送TTL从1开始递增的端口3万以上的UDP报文,如果经过的下一跳会响应该报文场景1:没有到达最终节点,回复TTL超时的ICMP报文。场景2:到达最终节点,回复端口不可达的ICMP报文。 缺点1. 阅读全文

posted @ 2024-12-03 21:35 王景迁 阅读(178) 评论(0) 推荐(0)

上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 69 下一页

导航