Skip to content

k.net

HTTP, WebSocket, DNS, IP, and remote connections

Overview

k.net provides network-related capabilities in site scripts, divided by sub-modules:

submodulepathPurpose
httpClientk.net.httpClientRecommended: proxy forwarding, JSON/form/multipart, send unified request
urlk.net.urlSimple synchronization HTTP; suitable for quickly pulling binaries (such as images)
webSocketk.net.webSocketUpgrade the current request to WebSocket and manage the connection
DNSk.net.DNSParse A/MX/NS, reverse DNS, Whois (note case)
IPk.net.IPCurrent request IP, IP geographic information (note case)
pingk.net.pingProbe ICMP connectivity and round-trip time
sshClientk.net.sshClientExecute commands over SSH
sftpClientk.net.sftpClientUpload and download files over SFTP
telnetClientk.net.telnetClientRead and write Telnet sessions

selection: httpClient and url

scenesuggestion
API proxy, with custom Header/Body, multipart uploadk.net.httpClient
Batch download, need KHttpResponse.save to downloadk.net.httpClient (including batch)
Fast GET remote image/file binaryk.net.url.getAsBinary(url)
One line GET string or JSONk.net.url.get / k.net.url.getJson
  • k.file — site disk file (different from outbound HTTP)
  • k.request — Current inbound request
  • k.utils — General utilities such as byte encoding conversion