Using the tls Module

If your transaction script needs to connect to a server over TCP secured with TLS, an additional module is available: tls. Its usage and syntax are very similar to that of the net module.

Importing the Module

To use the tls module, make sure to first import it within your transaction script:

import net from 'thousandeyes';

Creating a Connection

To create a client connection that includes TLS, use the connectTls function:

await net.connectTls(<port>, '<host.ip.address>', [OPTIONS])

Example GET Request with TLS

In the following example, notice that you first set host and port; then use those when you call net.connectTls:

import net from 'thousandeyes';
async function runScript() {
let host = '';
let port = 443;
let request_body =
`GET / HTTP/1.1
Host: ${host}
User-Agent: thousandeyes-transaction
let client = await net.connectTls(port, host);
await client.write(request_body);
let response = await;

For additional examples, see the public repository of ThousandEyes transaction scripts.