src/net/TorHelper.php
private static function getExitNodes() {
        $cache = Cache::me(__CLASS__);
        $nodes = $cache->get($key='tor_exit_nodes');

        if ($nodes == null) {

            // Einlesen der Nodes synchronisieren
            synchronized(function() use ($cache, $key, &$nodes) {
                $nodes = $cache->get($key);

                if ($nodes == null) {
                    $content = '';
                    $size = sizeof(self::$torMirrors);

                    for ($i=0; $i < $size; ++$i) {
                        $request = new HttpRequest('http://'.self::$torMirrors[$i].'/ip_list_exit.php/Tor_ip_list_EXIT.csv');
                        try {
                            // TODO: Warnung ausgeben und Reihenfolge aendern, wenn ein Server nicht antwortet
                            $response = (new CurlHttpClient())->send($request);
                            $status   = $response->getStatus();

                            if ($status != 200) {
                                self::$logNotice && Logger::log('Could not get TOR exit nodes from '.self::$torMirrors[$i].', HTTP status '.$status.' ('.HttpResponse::$sc[$status]."),\n URL: ".$request->getUrl(), L_NOTICE);
                                continue;
                            }
                        }
                        catch (IOException $ex) {
                            self::$logNotice && Logger::log('Could not get TOR exit nodes from '.self::$torMirrors[$i], L_NOTICE, ['exception'=>$ex]);
                            continue;
                        }

                        $content = trim($response->getContent());
                        break;
                    }

                    $nodes = strlen($content) ? \array_flip(explode(NL, normalizeEOL($content))) : [];

                    if (!$nodes) Logger::log('Could not get TOR exit nodes from any server', L_ERROR);

                    $cache->set($key, $nodes, 30 * MINUTES);
                }
            });
        }
        return $nodes;
    }
private static function getExitNodes() {
        $cache = Cache::me(__CLASS__);
        $nodes = $cache->get($key='tor_exit_nodes');

        if ($nodes == null) {

            // Einlesen der Nodes synchronisieren
            synchronized(function() use ($cache, $key, &$nodes) {
                $nodes = $cache->get($key);

                if ($nodes == null) {
                    $content = '';
                    $size = sizeof(self::$torMirrors);

                    for ($i=0; $i < $size; ++$i) {
                        $request = new HttpRequest('http://'.self::$torMirrors[$i].'/ip_list_exit.php/Tor_ip_list_EXIT.csv');
                        try {
                            // TODO: Warnung ausgeben und Reihenfolge aendern, wenn ein Server nicht antwortet
                            $response = (new CurlHttpClient())->send($request);
                            $status   = $response->getStatus();

                            if ($status != 200) {
                                self::$logNotice && Logger::log('Could not get TOR exit nodes from '.self::$torMirrors[$i].', HTTP status '.$status.' ('.HttpResponse::$sc[$status]."),\n URL: ".$request->getUrl(), L_NOTICE);
                                continue;
                            }
                        }
                        catch (IOException $ex) {
                            self::$logNotice && Logger::log('Could not get TOR exit nodes from '.self::$torMirrors[$i], L_NOTICE, ['exception'=>$ex]);
                            continue;
                        }

                        $content = trim($response->getContent());
                        break;
                    }

                    $nodes = strlen($content) ? \array_flip(explode(NL, normalizeEOL($content))) : [];

                    if (!$nodes) Logger::log('Could not get TOR exit nodes from any server', L_ERROR);

                    $cache->set($key, $nodes, 30 * MINUTES);
                }
            });
        }
        return $nodes;
    }
private static function getExitNodes ( ) { $ cache = Cache :: me ( __CLASS__ ) ; $ nodes = $ cache -> get ( $ key = 'tor_exit_nodes' ) ; if ( $ nodes == null ) { // Einlesen der Nodes synchronisieren synchronized ( function ( ) use ( $ cache , $ key , & $ nodes ) { $ nodes = $ cache -> get ( $ key ) ; if ( $ nodes == null ) { $ content = '' ; $ size = sizeof ( self :: $ torMirrors ) ; for ( $ i = 0 ; $ i < $ size ; ++ $ i ) { $ request = new HttpRequest ( 'http://' . self :: $ torMirrors [ $ i ] . '/ip_list_exit.php/Tor_ip_list_EXIT.csv' ) ; try { // TODO: Warnung ausgeben und Reihenfolge aendern, wenn ein Server nicht antwortet $ response = ( new CurlHttpClient ( ) ) -> send ( $ request ) ; $ status = $ response -> getStatus ( ) ; if ( $ status != 200 ) { self :: $ logNotice && Logger :: log ( 'Could not get TOR exit nodes from ' . self :: $ torMirrors [ $ i ] . ', HTTP status ' . $ status . ' (' . HttpResponse :: $ sc [ $ status ] . "),\n URL: " . $ request -> getUrl ( ) , L_NOTICE ) ; continue ; } } catch ( IOException $ ex ) { self :: $ logNotice && Logger :: log ( 'Could not get TOR exit nodes from ' . self :: $ torMirrors [ $ i ] , L_NOTICE , [ 'exception' => $ ex ] ) ; continue ; } $ content = trim ( $ response -> getContent ( ) ) ; break ; } $ nodes = strlen ( $ content ) ? \ array_flip ( explode ( NL , normalizeEOL ( $ content ) ) ) : [ ] ; if ( ! $ nodes ) Logger :: log ( 'Could not get TOR exit nodes from any server' , L_ERROR ) ; $ cache -> set ( $ key , $ nodes , 30 * MINUTES ) ; } } ) ; } return $ nodes ; }
Gibt die aktuellen Exit-Nodes zurueck.

@return array - assoziatives Array mit den IP-Adressen aller Exit-Nodes
Gibt die aktuellen Exit - Nodes zurueck .