Airship\Engine\Keyggdrasil\Peer::getAllURLs PHP Method

getAllURLs() public method

Get all URLs
public getAllURLs ( string $suffix = '', boolean $doNotShuffle = false ) : array
$suffix string
$doNotShuffle boolean
return array
    public function getAllURLs(string $suffix = '', bool $doNotShuffle = false) : array
    {
        $state = State::instance();
        $candidates = [];
        if ($state->universal['tor-only']) {
            // Prioritize Tor Hidden Services
            $after = [];
            foreach ($this->urls as $url) {
                if (\Airship\isOnionUrl($url)) {
                    $candidates[] = $url . $suffix;
                } else {
                    $after[] = $url . $suffix;
                }
            }
            if (!$doNotShuffle) {
                \Airship\secure_shuffle($candidates);
                \Airship\secure_shuffle($after);
            }
            foreach ($after as $url) {
                $candidates[] = $url . $suffix;
            }
        } else {
            $candidates = $this->urls;
            if (!$doNotShuffle) {
                \Airship\secure_shuffle($candidates);
            }
            foreach (\array_keys($candidates) as $i) {
                $candidates[$i] .= $suffix;
            }
        }
        return $candidates;
    }