源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s

This commit is contained in:
agent-radar
2026-09-01 20:17:27 +08:00
commit 2ed3415fb7
8018 changed files with 1936476 additions and 0 deletions
@@ -0,0 +1,52 @@
//go:build darwin
package interfacebind
import (
"context"
"fmt"
"net"
"syscall"
"golang.org/x/sys/unix"
)
// ListenUDP opens a UDP socket pinned to one Darwin interface. Binding the
// source address alone is insufficient when a utun route owns the destination;
// IP_BOUND_IF keeps STUN, ICE checks, and application packets on the selected
// physical path.
func ListenUDP(ctx context.Context, network string, addr *net.UDPAddr, interfaceIndex int) (*net.UDPConn, error) {
if addr == nil || addr.IP == nil || addr.IP.IsUnspecified() {
return nil, fmt.Errorf("listen UDP on interface requires a concrete local address")
}
if interfaceIndex <= 0 {
return nil, fmt.Errorf("listen UDP on interface requires a positive interface index")
}
level := unix.IPPROTO_IPV6
option := unix.IPV6_BOUND_IF
if addr.IP.To4() != nil {
level = unix.IPPROTO_IP
option = unix.IP_BOUND_IF
}
var socketErr error
lc := net.ListenConfig{
Control: func(_, _ string, raw syscall.RawConn) error {
if err := raw.Control(func(fd uintptr) {
socketErr = unix.SetsockoptInt(int(fd), level, option, interfaceIndex)
}); err != nil {
return err
}
return socketErr
},
}
packetConn, err := lc.ListenPacket(ctx, network, addr.String())
if err != nil {
return nil, err
}
conn, ok := packetConn.(*net.UDPConn)
if !ok {
_ = packetConn.Close()
return nil, fmt.Errorf("listen UDP returned %T", packetConn)
}
return conn, nil
}
@@ -0,0 +1,29 @@
//go:build !darwin
package interfacebind
import (
"context"
"fmt"
"net"
)
// ListenUDP keeps the shared interface explicit on non-Darwin builds. The
// first release only exposes direct physical routing on macOS; other platforms
// retain source-address binding until they grow a native interface option.
func ListenUDP(ctx context.Context, network string, addr *net.UDPAddr, _ int) (*net.UDPConn, error) {
if addr == nil || addr.IP == nil || addr.IP.IsUnspecified() {
return nil, fmt.Errorf("listen UDP on interface requires a concrete local address")
}
lc := net.ListenConfig{}
packetConn, err := lc.ListenPacket(ctx, network, addr.String())
if err != nil {
return nil, err
}
conn, ok := packetConn.(*net.UDPConn)
if !ok {
_ = packetConn.Close()
return nil, fmt.Errorf("listen UDP returned %T", packetConn)
}
return conn, nil
}