Skip to content

k.net ​

HTTP, WebSocket, DNS, IP, and remote connections

Execution ContextPrerequisitesTypical Use
KScript API, Page / View server scriptsRuntime network access to target endpoints or remote hostsOutbound HTTP proxying, WebSocket upgrades, DNS/IP lookups, and remote ops

k.net provides outbound network requests, real-time duplex communication, DNS and IP resolution, and remote terminal or file protocol clients in site scripts.

Quick Start ​

js
k.api.get("probe", () => {
  const res = k.net.httpClient.send("https://httpbin.org/get", "get")
  const ping = k.net.ping("kooboo.com")
  return {
    clientIp: k.net.IP.myIP,
    httpStatus: res.statusCode,
    pingReachable: ping.success
  }
})

Quick Reference ​

Submodule / MemberDescriptionDetails
k.net.httpClientRecommended: proxy forwarding, JSON/form/multipart, unified send, and batch taskshttpClient
k.net.urlConcise synchronous HTTP; quick text, JSON, or binary fetches (such as images)url
k.net.webSocketUpgrade current requests to WebSocket and manage intrasite connectionswebSocket
k.net.DNSResolve A/MX/NS, reverse DNS, and Whois (case-sensitive)DNS
k.net.IPCurrent client IP and IP geolocation lookups (case-sensitive)IP
k.net.ping(host)Probe ICMP connectivity and round-trip latencyping
k.net.sshClientExecute remote shell commands over SSHsshClient
k.net.sftpClientUpload and download files over SFTPsftpClient
k.net.telnetClientRead and write Telnet text-protocol sessionstelnetClient

Choosing Between httpClient and url

ScenarioRecommendation
API proxying, custom headers/bodies, or multipart uploadsk.net.httpClient
Batch downloads or saving via KHttpResponse.savek.net.httpClient (including batch)
Quickly fetching remote image or file bytesk.net.url.getAsBinary(url)
One-line GET as string or JSONk.net.url.get / k.net.url.getJson

TypeScript Definitions ​

ts
interface KNET {
  IP: KIP;
  url: Curl;
  httpClient: KHttpClient;
  webSocket: KWebSocket;
  DNS: KDNS;
  sshClient: SshClient;
  sftpClient: SftpClient;
  telnetClient: TelnetClient;
  ping(command: string): PingResult;
}

interface PingResult {
  ip: string;
  time: number;
  success: boolean;
}
  • k.file — Site disk files (distinct from outbound HTTP)
  • k.request — Current inbound request
  • k.utils — General utilities such as byte encoding conversion