1.6.10 • Published 6 months ago

@mimik/address-helper v1.6.10

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
6 months ago

address-helper

Example

const addressHelper = require('@mimik/address-helper');

address-helper~getAddressByType(type, addresses) ⇒ object

Get the address by type from an array of address.

Kind: inner method of address-helper
Returns: object - Address by type.
Category: sync

ParamTypeDescription
typestringType of address to return.
addressesArray.<object>Addresses from which the specific address is retrieved.

address-helper~hrefId(serverSettings, basePath, resource, id) ⇒ URL.<string>

Generate a href based of the given parameters.

Kind: inner method of address-helper
Returns: URL.<string> - Generated href.
Category: sync

ParamTypeDescription
serverSettingsobjectconfiguration to use to generate the href.
basePathPATH.<string>Base path to use to generate the href.
resourcePATH.<string>Resource to use to generate the href.
idUUID.<string>id to use to generate the href.

address-helper~addressTypeMaker(type, href, routingPort) ⇒ object

Generate an address using the given parameters.

Kind: inner method of address-helper
Returns: object - Generated address.
Category: sync

ParamTypeDescription
typestringtype to use the generate the address to return.
hrefURL.<string>URL to use to generate the address to return.
routingPortnumberRouting port to generate the address to return.

address-helper~addressFormat(type, protocol, ip, port, pathname, routingPort) ⇒ object

Return an address using the given parameters.

Kind: inner method of address-helper
Returns: object - Generated address.
Category: sync

ParamTypeDescription
typestringtype to use the generate the address to return.
protocolstringprotocol to use to generate the address to return.
ipIP.<string>Ip to use to generate the address to return.
portnumberPort to use to generate the address to return.
pathnamePATH.<string>Path to add to generate the address to return.
routingPortnumberPort to use to set the address to return.

address-helper~addressFromNode(type, ip, node, routingPort) ⇒ object

Return an address corresponding to the given parameters.

Kind: inner method of address-helper
Summary: If the type is proxy, a inversion using routingPort is done.
Returns: object - Generated address corresponding to the given parameters.
Category: sync

ParamTypeDescription
typestringType of address to return
ipIP.<string>IP address to used to generate the address to return.
nodeobjectNode to use to generate the address to return.
routingPortnumberRouting port to use to generate the address to return.

address-helper~getAddress(node, localLinkNetworkId) ⇒ object

Return the address to be used to reach the node.

Kind: inner method of address-helper
Summary: If localLinkNetworkId is present, return the local address. Otherwise return the proxy address, if it exists, or the public address.
Returns: object - Address to use to reach the node.
Category: sync

ParamTypeDescription
nodeobjectNode from which to get the address.
localLinkNetworkIdstringId of the link local network to get the address from.

address-helper~updateAddresses(type, newAddress, addresses) ⇒ Array.<object>

Add a new address of a specific type in the array of addresses.

Kind: inner method of address-helper
Returns: Array.<object> - Updated array of addresses.
Category: sync

ParamTypeDescription
typestringType of address to add.
newAddressobjectNew address to add the the array of addresses.
addressesArray.<object>Initial array of addresses to which the new address will be added.

address-helper~publicIpFromNode(node) ⇒ IP.<string>

Get the public IP address from the registering node.

Kind: inner method of address-helper
Summary: If node is not defined return null.
Returns: IP.<string> - Public IP address of the node.
Category: sync

ParamTypeDescription
nodeobjectThe node containing the public IP address.

address-helper~publicIpFromRequest(req) ⇒ IP.<string>

Get the public IP address from the http request.

Kind: inner method of address-helper
Returns: IP.<string> - Public IP address of the component making the request.

Env variable nameDescriptionDefaultComments
IPV4when existent on non null, will translate an IPV6 address into IPV4 address when possible::1 will be translated to `127.0.0.1

If the environment variable IPV4 is set to true, the ip address will be translated to IPV4 address when possible, and ::1 will be translated to 127.0.0.1.
Category: sync

ParamTypeDescription
reqobjectThe http request to get the public IP address.
1.6.10

6 months ago

1.6.9

1 year ago

1.6.8

1 year ago

1.6.7

1 year ago

1.6.6

1 year ago

1.6.5

1 year ago

1.6.4

2 years ago

1.6.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.3.0

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

6 years ago