Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETSCRIPT: Add functionality and support to fully allow Players to use IP addresses in place of hostnames #1990

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion markdown/bitburner.codingcontract.attempt.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ attempt(answer: any, filename: string, host?: string): string;
| --- | --- | --- |
| answer | any | Attempted solution for the contract. This can be a string formatted like submitting manually, or the answer in the format of the specific contract type. |
| filename | string | Filename of the contract. |
| host | string | _(Optional)_ Hostname of the server containing the contract. Optional. Defaults to current server if not provided. |
| host | string | _(Optional)_ Hostname/IP of the server containing the contract. Optional. Defaults to current server if not provided. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.codingcontract.getcontract.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getContract(filename: string, host?: string): CodingContractObject;
| Parameter | Type | Description |
| --- | --- | --- |
| filename | string | Filename of the contract. |
| host | string | _(Optional)_ Host of the server containing the contract. Optional. Default to the current server if not provided. |
| host | string | _(Optional)_ Hostname/IP of the server containing the contract. Optional. Default to the current server if not provided. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.codingcontract.getcontracttype.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getContractType(filename: string, host?: string): `${CodingContractName}`;
| Parameter | Type | Description |
| --- | --- | --- |
| filename | string | Filename of the contract. |
| host | string | _(Optional)_ Hostname of the server containing the contract. Optional. Defaults to current server if not provided. |
| host | string | _(Optional)_ Hostname/IP of the server containing the contract. Optional. Defaults to current server if not provided. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.codingcontract.getdata.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getData(filename: string, host?: string): any;
| Parameter | Type | Description |
| --- | --- | --- |
| filename | string | Filename of the contract. |
| host | string | _(Optional)_ Host of the server containing the contract. Optional. Defaults to current server if not provided. |
| host | string | _(Optional)_ Hostname/IP of the server containing the contract. Optional. Defaults to current server if not provided. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.codingcontract.getdescription.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getDescription(filename: string, host?: string): string;
| Parameter | Type | Description |
| --- | --- | --- |
| filename | string | Filename of the contract. |
| host | string | _(Optional)_ Hostname of the server containing the contract. Optional. Defaults to current server if not provided. |
| host | string | _(Optional)_ Hostname/IP of the server containing the contract. Optional. Defaults to current server if not provided. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.codingcontract.getnumtriesremaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getNumTriesRemaining(filename: string, host?: string): number;
| Parameter | Type | Description |
| --- | --- | --- |
| filename | string | Filename of the contract. |
| host | string | _(Optional)_ Hostname of the server containing the contract. Optional. Defaults to current server if not provided. |
| host | string | _(Optional)_ Hostname/IP of the server containing the contract. Optional. Defaults to current server if not provided. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.hacknet.spendhashes.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This function is only applicable for Hacknet Servers (the upgraded version of a

Spend the hashes generated by your Hacknet Servers on an upgrade. Returns a boolean value - true if the upgrade is successfully purchased, and false otherwise.

The name of the upgrade must be an exact match. The `upgTarget` argument is used for upgrades such as `Reduce Minimum Security`<!-- -->, which applies to a specific server. In this case, the `upgTarget` argument must be the hostname of the server.
The name of the upgrade must be an exact match. The `upgTarget` argument is used for upgrades such as `Reduce Minimum Security`<!-- -->, which applies to a specific server. In this case, the `upgTarget` argument must be the hostname or IP of the server.

## Example

Expand Down
20 changes: 20 additions & 0 deletions markdown/bitburner.hostreturnoptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [HostReturnOptions](./bitburner.hostreturnoptions.md)

## HostReturnOptions interface

Options to control how a server identifier (hostname or IP address) is returned. Affects the behavior of [scan](./bitburner.ns.scan.md)<!-- -->, [getPurchasedServers](./bitburner.ns.getpurchasedservers.md)<!-- -->, and [getCurrentServer](./bitburner.singularity.getcurrentserver.md)

**Signature:**

```typescript
interface HostReturnOptions
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [returnByIP?](./bitburner.hostreturnoptions.returnbyip.md) | | boolean | _(Optional)_ If set to <code>true</code>, returns IP addresses instead of hostnames. Defaults to <code>false</code>. |

13 changes: 13 additions & 0 deletions markdown/bitburner.hostreturnoptions.returnbyip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [HostReturnOptions](./bitburner.hostreturnoptions.md) &gt; [returnByIP](./bitburner.hostreturnoptions.returnbyip.md)

## HostReturnOptions.returnByIP property

If set to `true`<!-- -->, returns IP addresses instead of hostnames. Defaults to `false`<!-- -->.

**Signature:**

```typescript
returnByIP?: boolean;
```
1 change: 1 addition & 0 deletions markdown/bitburner.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
| [HacknetRAMRequirement](./bitburner.hacknetramrequirement.md) | Player's Hacknet devices must have at least this much total RAM. |
| [HacknetServerConstants](./bitburner.hacknetserverconstants.md) | Hacknet server related constants |
| [HacknetServersFormulas](./bitburner.hacknetserversformulas.md) | Hacknet Server formulas |
| [HostReturnOptions](./bitburner.hostreturnoptions.md) | Options to control how a server identifier (hostname or IP address) is returned. Affects the behavior of [scan](./bitburner.ns.scan.md)<!-- -->, [getPurchasedServers](./bitburner.ns.getpurchasedservers.md)<!-- -->, and [getCurrentServer](./bitburner.singularity.getcurrentserver.md) |
| [HP](./bitburner.hp.md) | |
| [ILocation](./bitburner.ilocation.md) | |
| [IndustryData](./bitburner.industrydata.md) | Corporation industry information |
Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.brutessh.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ brutessh(host: string): boolean;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of the target server. |
| host | string | Hostname/IP of the target server. |

**Returns:**

Expand Down
6 changes: 3 additions & 3 deletions markdown/bitburner.ns.deleteserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ deleteServer(host: string): boolean;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of the server to delete. |
| host | string | Hostname/IP of the server to delete. |

**Returns:**

Expand All @@ -28,7 +28,7 @@ True if successful, and false otherwise.

2.25 GB

Deletes one of your purchased servers, which is specified by its hostname.
Deletes one of your purchased servers, which is specified by its hostname/ip.

The hostname argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from the string. This function will not delete a server that still has scripts running on it.
The host argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from the string. This function will not delete a server that still has scripts running on it.

28 changes: 28 additions & 0 deletions markdown/bitburner.ns.dnslookup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [dnsLookup](./bitburner.ns.dnslookup.md)

## NS.dnsLookup() method

Given a hostname, returns its IP address; or given an IP address, returns its hostname.

**Signature:**

```typescript
dnsLookup(host: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname/IP of target server. |

**Returns:**

string

## Remarks

RAM cost: 0 GB

4 changes: 2 additions & 2 deletions markdown/bitburner.ns.exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Start another script on any server.
**Signature:**

```typescript
exec(script: string, hostname: string, threadOrOptions?: number | RunOptions, ...args: ScriptArg[]): number;
exec(script: string, host: string, threadOrOptions?: number | RunOptions, ...args: ScriptArg[]): number;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| script | string | Filename of script to execute. This file must already exist on the target server. |
| hostname | string | Hostname of the <code>target server</code> on which to execute the script. |
| host | string | Hostname/IP of the <code>target server</code> on which to execute the script. |
| threadOrOptions | number \| [RunOptions](./bitburner.runoptions.md) | _(Optional)_ Either an integer number of threads for new script, or a [RunOptions](./bitburner.runoptions.md) object. Threads defaults to 1. |
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Additional arguments to pass into the new script that is being run. Note that if any arguments are being passed into the new script, then the third argument threadOrOptions must be filled in with a value. |

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.fileexists.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fileExists(filename: string, host?: string): boolean;
| Parameter | Type | Description |
| --- | --- | --- |
| filename | string | Filename of file to check. |
| host | string | _(Optional)_ Host of target server. Optional, defaults to the server the script is running on. |
| host | string | _(Optional)_ Hostname/IP of target server. Optional, defaults to the server the script is running on. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.ftpcrack.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ftpcrack(host: string): boolean;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of the target server. |
| host | string | Hostname/IP of the target server. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getgrowtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ getGrowTime(host: string): number;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of target server. |
| host | string | Hostname/IP of target server. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.gethacktime.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ getHackTime(host: string): number;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of target server. |
| host | string | Hostname/IP of target server. |

**Returns:**

Expand Down
23 changes: 23 additions & 0 deletions markdown/bitburner.ns.getip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [getIP](./bitburner.ns.getip.md)

## NS.getIP() method

Returns a string with the IP address of the server that the script is running on.

**Signature:**

```typescript
getIP(): string;
```
**Returns:**

string

IP address of the server that the script runs on.

## Remarks

RAM cost: 0.05 GB

13 changes: 10 additions & 3 deletions markdown/bitburner.ns.getpurchasedservers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@

## NS.getPurchasedServers() method

Returns an array with the hostnames of all of the servers you have purchased.
Returns an array with the hostnames or IP addresses of all of the servers you have purchased. Returns hostnames by default.

**Signature:**

```typescript
getPurchasedServers(): string[];
getPurchasedServers(returnOpts?: HostReturnOptions): string[];
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| returnOpts | [HostReturnOptions](./bitburner.hostreturnoptions.md) | _(Optional)_ Optional. Controls whether the function returns IPs |

**Returns:**

string\[\]

Returns an array with the hostnames of all of the servers you have purchased.
Returns an array with the hostnames or IP addresses of all of the servers you have purchased.

## Remarks

Expand Down
6 changes: 3 additions & 3 deletions markdown/bitburner.ns.getpurchasedserverupgradecost.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ Get cost of upgrading a purchased server to the given ram.
**Signature:**

```typescript
getPurchasedServerUpgradeCost(hostname: string, ram: number): number;
getPurchasedServerUpgradeCost(host: string, ram: number): number;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| hostname | string | Hostname of the server to upgrade. |
| host | string | Hostname/IP of the server to upgrade. |
| ram | number | Amount of RAM of the purchased server, in GB. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20). |

**Returns:**

number

The price to upgrade or -1 if either input is not valid, i.e. hostname is not the name of a purchased server or ram is not a valid amount.
The price to upgrade or -1 if either input is not valid, i.e. host is not the name of a purchased server or ram is not a valid amount.

## Remarks

Expand Down
6 changes: 3 additions & 3 deletions markdown/bitburner.ns.getrunningscript.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Get general info about a running script.
**Signature:**

```typescript
getRunningScript(filename?: FilenameOrPID, hostname?: string, ...args: ScriptArg[]): RunningScript | null;
getRunningScript(filename?: FilenameOrPID, host?: string, ...args: ScriptArg[]): RunningScript | null;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| filename | [FilenameOrPID](./bitburner.filenameorpid.md) | _(Optional)_ Optional. Filename or PID of the script. |
| hostname | string | _(Optional)_ Hostname of target server. Optional, defaults to the server the calling script is running on. |
| host | string | _(Optional)_ Hostname/IP of target server. Optional, defaults to the server the calling script is running on. |
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments to specify/identify the script. Optional, when looking for scripts run without arguments. |

**Returns:**
Expand All @@ -30,5 +30,5 @@ The info about the running script if found, and null otherwise.

RAM cost: 0.3 GB

Running with no args returns current script. If you use a PID as the first parameter, the hostname and args parameters are unnecessary. If hostname is omitted while filename is used as the first parameter, hostname defaults to the server the calling script is running on. Remember that a script is semi-uniquely identified by both its name and its arguments. (You can run multiple copies of scripts with the same arguments, but for the purposes of functions like this that check based on filename, the filename plus arguments forms the key.)
Running with no args returns current script. If you use a PID as the first parameter, the host and args parameters are unnecessary. If host is omitted while filename is used as the first parameter, host defaults to the server the calling script is running on. Remember that a script is semi-uniquely identified by both its name and its arguments. (You can run multiple copies of scripts with the same arguments, but for the purposes of functions like this that check based on filename, the filename plus arguments forms the key.)

2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getscriptexpgain.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getScriptExpGain(script: string, host: string, ...args: ScriptArg[]): number;
| Parameter | Type | Description |
| --- | --- | --- |
| script | string | Filename of script. |
| host | string | Server on which script is running. |
| host | string | Hostname/IP of the server on which script is running. |
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments that the script is running with. |

**Returns:**
Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getscriptincome.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getScriptIncome(script: string, host: string, ...args: ScriptArg[]): number;
| Parameter | Type | Description |
| --- | --- | --- |
| script | string | Filename of script. |
| host | string | Server on which script is running. |
| host | string | Hostname/IP of the server on which script is running. |
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments that the script is running with. |

**Returns:**
Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getscriptlogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getScriptLogs(fn?: FilenameOrPID, host?: string, ...args: ScriptArg[]): string[]
| Parameter | Type | Description |
| --- | --- | --- |
| fn | [FilenameOrPID](./bitburner.filenameorpid.md) | _(Optional)_ Optional. Filename or PID of script to get logs from. |
| host | string | _(Optional)_ Optional. Hostname of the server that the script is on. |
| host | string | _(Optional)_ Optional. Hostname/IP of the server that the script is on. |
| args | [ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\] | Arguments to identify which scripts to get logs for. |

**Returns:**
Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getscriptram.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ getScriptRam(script: string, host?: string): number;
| Parameter | Type | Description |
| --- | --- | --- |
| script | string | Filename of script. This is case-sensitive. |
| host | string | _(Optional)_ Hostname of target server the script is located on. This is optional. If it is not specified then the function will use the current server as the target server. |
| host | string | _(Optional)_ Hostname/IP of target server the script is located on. This is optional. If it is not specified then the function will use the current server as the target server. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ getServer(host?: string): Server;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | _(Optional)_ Optional. Hostname for the requested server object. |
| host | string | _(Optional)_ Optional. Hostname/IP for the requested server object. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getserverbasesecuritylevel.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ getServerBaseSecurityLevel(host: string): number;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Host of target server. |
| host | string | Hostname/IP of target server. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getservergrowth.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ getServerGrowth(host: string): number;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of target server. |
| host | string | Hostname/IP of target server. |

**Returns:**

Expand Down
2 changes: 1 addition & 1 deletion markdown/bitburner.ns.getservermaxmoney.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ getServerMaxMoney(host: string): number;

| Parameter | Type | Description |
| --- | --- | --- |
| host | string | Hostname of target server. |
| host | string | Hostname/IP of target server. |

**Returns:**

Expand Down
Loading