BlockList

external class BlockList(source)

The BlockList object can be used with some network APIs to specify rules for disabling inbound or outbound access to specific IP addresses, IP ranges, or IP subnets.

Since

v15.0.0, v14.18.0

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
external object Companion

Properties

Link copied to clipboard
external var rules: ReadonlyArray<String>

The list of rules added to the blocklist.

Functions

Link copied to clipboard
external fun addAddress(address: SocketAddress)

external fun addAddress(address: String, type: IPVersion = definedExternally)

Adds a rule to block the given IP address.

Link copied to clipboard
external fun addRange(start: SocketAddress, end: SocketAddress)

external fun addRange(start: String, end: String, type: IPVersion = definedExternally)

Adds a rule to block a range of IP addresses from start (inclusive) toend (inclusive).

Link copied to clipboard
external fun addSubnet(net: SocketAddress, prefix: Number)

Adds a rule to block a range of IP addresses specified as a subnet mask.

external fun addSubnet(net: String, prefix: Number, type: IPVersion = definedExternally)
Link copied to clipboard
external fun check(address: SocketAddress): Boolean

Returns true if the given IP address matches any of the rules added to theBlockList.

external fun check(address: String, type: IPVersion = definedExternally): Boolean
Link copied to clipboard
external fun fromJSON(data: ReadonlyArray<String>)
external fun fromJSON(data: String)
Link copied to clipboard
external fun toJSON(): ReadonlyArray<String>