跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

ipv6_drop_test.go

22 行 · 695 B历史下载
1package tap
2
3import (
4 "bytes"
5 "context"
6 "testing"
7)
8
9// The observer must run on data read from the guest, before forwarding the
10// frame to any other peer or to the IPv4 stack.
11func TestIPv6DropAtGuestIngress(t *testing.T) {
12 s := NewSwitch(false)
13 payload := []byte{0x60, 0, 0, 0, 0, 0, 17, 1}
14 ethernet := make([]byte, 14)
15 ethernet[12], ethernet[13] = 0x86, 0xdd
16 var seen []byte
17 s.SetDroppedIPv6(func(packet []byte) { seen = append(seen, packet...) })
18 s.rxBuf(context.Background(), 1, append(ethernet, payload...))
19 if !bytes.Equal(seen, payload) || s.Sent != 0 || s.Received != uint64(len(ethernet)+len(payload)) {
20 t.Fatal("IPv6 frame was not observed and dropped at ingress")
21 }
22}