PHP 클래스 TorControl\TorControl

Control a Tor server using the socket connection. The spec of the control protocol: https://gitweb.torproject.org/torspec.git/blob_plain/HEAD:/control-spec.txt
저자: Kévin Dunglas ([email protected])
파일 보기 프로젝트 열기: dunglas/php-torcontrol 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$connected boolean Connected.
$defautOptions array Default options.
$options array Options.
$socket resource Socket to the TOR server.

공개 메소드들

메소드 설명
__construct ( array $options = [] ) Creates a new instance of the controller.
__destruct ( ) Destructs the instance.
authenticate ( ) : TorControl Authenticates to the Tor server.
connect ( ) : TorControl Connects to the Tor server.
executeCommand ( string $cmd ) : array Executes a command on the Tor server.
getOption ( string $key ) : mixed Gets an option.
isConnected ( ) : boolean Gets the controller connection status.
quit ( ) Closes the connection to the Tor server.
quote ( string $str ) : string Quotes and escapes to use in a command.

비공개 메소드들

메소드 설명
checkConnected ( ) Check if connected.
detectAuthMethod ( ) Detects auth method using the PROTOCOLINFO command.

메소드 상세

__construct() 공개 메소드

Creates a new instance of the controller.
public __construct ( array $options = [] )
$options array Configuration settings All settings are optional. - hostname: server to join (default: 127.0.0.1) - port: port to try (default: 9051) - authmethod: connection method (if not set will try to autodetect) Allowed values: - TorControl::AUTH_METHOD_NULL: no security - TorControl::AUTH_METHOD_HASHEDPASSWORD: password - TorControl::AUTH_METHOD_COOKIE: cookie file - password: the password (mandatory if AUTH_METHOD_HASHEDPASSWORD is used) - cookiefile: the file (if TorControl::AUTH_METHOD_COOKIE is used, if not set will autodetect) - timeout: connection timeout (default: default_socket_timeout's PHP setting)

__destruct() 공개 메소드

Destructs the instance.
public __destruct ( )

authenticate() 공개 메소드

Autodetect authentication method if not set in options
public authenticate ( ) : TorControl
리턴 TorControl

connect() 공개 메소드

Connects to the Tor server.
public connect ( ) : TorControl
리턴 TorControl

executeCommand() 공개 메소드

Executes a command on the Tor server.
public executeCommand ( string $cmd ) : array
$cmd string
리턴 array

getOption() 공개 메소드

Gets an option.
public getOption ( string $key ) : mixed
$key string
리턴 mixed

isConnected() 공개 메소드

Gets the controller connection status.
public isConnected ( ) : boolean
리턴 boolean

quit() 공개 메소드

Closes the connection to the Tor server.
public quit ( )

quote() 공개 정적인 메소드

Quotes and escapes to use in a command.
public static quote ( string $str ) : string
$str string
리턴 string

프로퍼티 상세

$connected 보호되어 있는 프로퍼티

Connected.
protected bool $connected
리턴 boolean

$defautOptions 보호되어 있는 정적으로 프로퍼티

Default options.
protected static array $defautOptions
리턴 array

$options 보호되어 있는 프로퍼티

Options.
protected array $options
리턴 array

$socket 보호되어 있는 프로퍼티

Socket to the TOR server.
protected resource $socket
리턴 resource