Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问clear审计提醒

axiom-networking-legacyAxiom 网络遗产

Agent Skill

axiom-networking-legacy 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

3,951

周安装

168

GitHub Stars

873

下载量

1,384
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:axiom-networking-legacy(Axiom 网络遗产)
来源仓库:https://github.com/charleswiltgen/axiom
仓库路径:skills/axiom-networking-legacy
安装命令:
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-networking-legacy
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-networking-legacy

简介

针对 iOS 12-25 版本的 NWConnection 遗留模式提供详细实现范例。

  • 适用于仍需支持旧版系统的项目,展示带 TLS 的 NWConnection 配置与完成处理器用法。
  • 包含自定义协议实现、监听器设置及错误回调处理等典型代码结构。
  • 若目标为 iOS 26+,应优先采用 NetworkConnection 配合 async/await 的新范式。
  • 使用时需注意内存管理与线程安全,避免引入 retain cycle 或资源泄漏。

SKILL.md

Legacy iOS 12-25 NWConnection Patterns

These patterns use NWConnection with completion handlers for apps supporting iOS 12-25. If your app targets iOS 26+, use NetworkConnection with async/await instead (see axiom-network-framework-ref skill).

Pattern 2a: NWConnection with TLS (iOS 12-25)

Use when Supporting iOS 12-25, need TLS encryption, can't use async/await yet

Time cost 10-15 minutes

GOOD: NWConnection with Completion Handlers

import Network

// Create connection with TLS
let connection = NWConnection(
    host: NWEndpoint.Host("mail.example.com"),
    port: NWEndpoint.Port(integerLiteral: 993),
    using: .tls // TCP inferred
)

// Handle connection state changes
connection.stateUpdateHandler = { [weak self] state in
    switch state {
    case .ready:
        print("Connection established")
        self?.sendInitialData()
    case .waiting(let error):
        print("Waiting for network: \(error)")
        // Show "Waiting..." UI, don't fail immediately
    case .failed(let error):
        print("Connection failed: \(error)")
    case .cancelled:
        print("Connection cancelled")
    default:
        break
    }
}

// Start connection
connection.start(queue: .main)

// Send data with pacing
func sendData() {
    let data = Data("Hello, world!".utf8)
    connection.send(content: data, completion: .contentProcessed { [weak self] error in
        if let error = error {
            print("Send error: \(error)")
            return
        }
        // contentProcessed callback = network stack consumed data
        // This is when you should send next chunk (pacing)
        self?.sendNextChunk()
    })
}

// Receive exact byte count
func receiveData() {
    connection.receive(minimumIncompleteLength: 10, maximumLength: 10) { [weak self] (data, context, isComplete, error) in
        if let error = error {
            print("Receive error: \(error)")
            return
        }

        if let data = data {
            print("Received \(data.count) bytes")
            // Process data...
            self?.receiveData() // Continue receiving
        }
    }
}

Key differences from NetworkConnection

  • Must use [weak self] in all completion handlers to prevent retain cycles
  • stateUpdateHandler receives state, not async sequence
  • send/receive use completion callbacks, not async/await

When to use

  • Supporting iOS 12-15 (70% of devices as of 2024)
  • Codebases not yet using async/await
  • Libraries needing backward compatibility

Migration to NetworkConnection (iOS 26+)

  • stateUpdateHandler -> connection.states async sequence
  • Completion handlers -> try await calls
  • [weak self] -> No longer needed (async/await handles cancellation)

Pattern 2b: NWConnection UDP Batch (iOS 12-25)

Use when Supporting iOS 12-25, sending multiple UDP datagrams efficiently, need ~30% CPU reduction

Time cost 10-15 minutes

Background Traditional UDP sockets send one datagram per syscall. If you're sending 100 small packets, that's 100 context switches. Batching reduces this to ~1 syscall.

BAD: Individual UDP Sends (High CPU)

// WRONG — 100 context switches for 100 packets
for frame in videoFrames {
    sendto(socket, frame.bytes, frame.count, 0, &addr, addrlen)
    // Each send = context switch to kernel
}

GOOD: Batched UDP Sends (30% Lower CPU)

import Network

// UDP connection
let connection = NWConnection(
    host: NWEndpoint.Host("stream-server.example.com"),
    port: NWEndpoint.Port(integerLiteral: 9000),
    using: .udp
)

connection.stateUpdateHandler = { state in
    if case .ready = state {
        print("Ready to send UDP")
    }
}

connection.start(queue: .main)

// Batch sending for efficiency
func sendVideoFrames(_ frames: [Data]) {
    connection.batch {
        for frame in frames {
            connection.send(content: frame, completion: .contentProcessed { error in
                if let error = error {
                    print("Send error: \(error)")
                }
            })
        }
    }
    // All sends batched into ~1 syscall
    // 30% lower CPU usage vs individual sends
}

// Receive UDP datagrams
func receiveFrames() {
    connection.receive(minimumIncompleteLength: 1, maximumLength: 65536) { [weak self] (data, context, isComplete, error) in
        if let error = error {
            print("Receive error: \(error)")
            return
        }

        if let data = data {
            // Process video frame
            self?.displayFrame(data)
            self?.receiveFrames() // Continue receiving
        }
    }
}

Performance characteristics

  • Without batch 100 datagrams = 100 syscalls = 100 context switches
  • With batch 100 datagrams = ~1 syscall = 1 context switch
  • Result ~30% lower CPU usage (measured with Instruments)

When to use

  • Real-time video/audio streaming
  • Gaming with frequent updates (player position)
  • High-frequency sensor data (IoT)

WWDC 2018 demo Live video streaming showed 30% lower CPU on receiver with user-space networking + batching

Pattern 2c: NWListener (iOS 12-25)

Use when Need to accept incoming connections, building servers or peer-to-peer apps, supporting iOS 12-25

Time cost 20-25 minutes

BAD: Manual Socket Listening

// WRONG — Manual socket management
let sock = socket(AF_INET, SOCK_STREAM, 0)
bind(sock, &addr, addrlen)
listen(sock, 5)
while true {
    let client = accept(sock, nil, nil) // Blocks thread
    // Handle client...
}

GOOD: NWListener with Automatic Connection Handling

import Network

// Create listener with default parameters
let listener = try NWListener(using: .tcp, on: 1029)

// Advertise Bonjour service
listener.service = NWListener.Service(name: "MyApp", type: "_myservice._tcp")

// Handle service registration updates
listener.serviceRegistrationUpdateHandler = { update in
    switch update {
    case .add(let endpoint):
        if case .service(let name, let type, let domain, _) = endpoint {
            print("Advertising as: \(name).\(type)\(domain)")
        }
    default:
        break
    }
}

// Handle incoming connections
listener.newConnectionHandler = { [weak self] newConnection in
    print("New connection from: \(newConnection.endpoint)")

    // Configure connection
    newConnection.stateUpdateHandler = { state in
        switch state {
        case .ready:
            print("Client connected")
            self?.handleClient(newConnection)
        case .failed(let error):
            print("Client connection failed: \(error)")
        default:
            break
        }
    }

    // Start handling this connection
    newConnection.start(queue: .main)
}

// Handle listener state
listener.stateUpdateHandler = { state in
    switch state {
    case .ready:
        print("Listener ready on port \(listener.port ?? 0)")
    case .failed(let error):
        print("Listener failed: \(error)")
    default:
        break
    }
}

// Start listening
listener.start(queue: .main)

// Handle client data
func handleClient(_ connection: NWConnection) {
    connection.receive(minimumIncompleteLength: 1, maximumLength: 65536) { [weak self] (data, context, isComplete, error) in
        if let error = error {
            print("Receive error: \(error)")
            return
        }

        if let data = data {
            print("Received \(data.count) bytes")

            // Echo back
            connection.send(content: data, completion: .contentProcessed { error in
                if let error = error {
                    print("Send error: \(error)")
                }
            })

            self?.handleClient(connection) // Continue receiving
        }
    }
}

When to use

  • Peer-to-peer apps (file sharing, messaging)
  • Local network services
  • Development/testing servers

Bonjour advertising

  • Automatic service discovery on local network
  • No hardcoded IPs needed
  • Works with NWBrowser for discovery

Security considerations

  • Use TLS parameters for encryption: NWListener(using:.tls, on: port)
  • Validate client connections before processing data
  • Set connection limits to prevent DoS

Pattern 2d: Network Discovery (iOS 12-25)

Use when Discovering services on local network (Bonjour), building peer-to-peer apps, supporting iOS 12-25

Time cost 25-30 minutes

BAD: Hardcoded IP Addresses

// WRONG — Brittle, requires manual configuration
let connection = NWConnection(host: "192.168.1.100", port: 9000, using: .tcp)
// What if IP changes? What if multiple devices?

GOOD: NWBrowser for Service Discovery

import Network

// Browse for services on local network
let browser = NWBrowser(for: .bonjour(type: "_myservice._tcp", domain: nil), using: .tcp)

// Handle discovered services
browser.browseResultsChangedHandler = { results, changes in
    for result in results {
        switch result.endpoint {
        case .service(let name, let type, let domain, _):
            print("Found service: \(name).\(type)\(domain)")
            // Connect to this service
            self.connectToService(result.endpoint)
        default:
            break
        }
    }
}

// Handle browser state
browser.stateUpdateHandler = { state in
    switch state {
    case .ready:
        print("Browser ready")
    case .failed(let error):
        print("Browser failed: \(error)")
    default:
        break
    }
}

// Start browsing
browser.start(queue: .main)

// Connect to discovered service
func connectToService(_ endpoint: NWEndpoint) {
    let connection = NWConnection(to: endpoint, using: .tcp)

    connection.stateUpdateHandler = { state in
        if case .ready = state {
            print("Connected to service")
        }
    }

    connection.start(queue: .main)
}

When to use

  • Peer-to-peer discovery (AirDrop-like features)
  • Local network printers, media servers
  • Development/testing (find test servers automatically)

Performance characteristics

  • mDNS-based (multicast DNS, no central server)
  • Near-instant discovery on same subnet
  • Automatic updates when services appear/disappear

iOS 26+ alternative

  • Use NetworkBrowser with Wi-Fi Aware for peer-to-peer without infrastructure
  • See Pattern 1d in axiom-network-framework-ref skill

Resources

Skills: axiom-networking, axiom-network-framework-ref, axiom-networking-migration

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.38%
按下载量换算407

Codex

24.76%
按下载量换算343

OpenCode

18.19%
按下载量换算252

Antigravity

12.78%
按下载量换算177

Cursor

8.09%
按下载量换算112

windsurf

3.43%
按下载量换算47

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills