ControlServer.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ControlServer - Documentation</title>
  6. <script src="scripts/prettify/prettify.js"></script>
  7. <script src="scripts/prettify/lang-css.js"></script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
  13. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  14. </head>
  15. <body>
  16. <input type="checkbox" id="nav-trigger" class="nav-trigger" />
  17. <label for="nav-trigger" class="navicon-button x">
  18. <div class="navicon"></div>
  19. </label>
  20. <label for="nav-trigger" class="overlay"></label>
  21. <nav>
  22. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ControlServer.html">ControlServer</a><ul class='methods'><li data-type='method'><a href="ControlServer.html#.instance_info">instance_info</a></li><li data-type='method'><a href="ControlServer.html#close">close</a></li><li data-type='method'><a href="ControlServer.html#createDNSServer">createDNSServer</a></li><li data-type='method'><a href="ControlServer.html#createHTTPServer">createHTTPServer</a></li><li data-type='method'><a href="ControlServer.html#createSOCKSServer">createSOCKSServer</a></li><li data-type='method'><a href="ControlServer.html#createTorPool">createTorPool</a></li><li data-type='method'><a href="ControlServer.html#listen">listen</a></li><li data-type='method'><a href="ControlServer.html#listenTcp">listenTcp</a></li><li data-type='method'><a href="ControlServer.html#listenWs">listenWs</a></li></ul></li><li><a href="DNSServer.html">DNSServer</a><ul class='methods'><li data-type='method'><a href="DNSServer.html#listen">listen</a></li></ul></li><li><a href="HTTPServer.html">HTTPServer</a><ul class='methods'><li data-type='method'><a href="HTTPServer.html#listen">listen</a></li></ul></li><li><a href="SOCKSServer.html">SOCKSServer</a><ul class='methods'><li data-type='method'><a href="SOCKSServer.html#listen">listen</a></li></ul></li><li><a href="TorPool.html">TorPool</a><ul class='methods'><li data-type='method'><a href="TorPool.html#add">add</a></li><li data-type='method'><a href="TorPool.html#add_instance_to_group">add_instance_to_group</a></li><li data-type='method'><a href="TorPool.html#add_instance_to_group_at">add_instance_to_group_at</a></li><li data-type='method'><a href="TorPool.html#add_instance_to_group_by_name">add_instance_to_group_by_name</a></li><li data-type='method'><a href="TorPool.html#create">create</a></li><li data-type='method'><a href="TorPool.html#create_instance">create_instance</a></li><li data-type='method'><a href="TorPool.html#exit">exit</a></li><li data-type='method'><a href="TorPool.html#get_config_at">get_config_at</a></li><li data-type='method'><a href="TorPool.html#get_config_by_name">get_config_by_name</a></li><li data-type='method'><a href="TorPool.html#instance_at">instance_at</a></li><li data-type='method'><a href="TorPool.html#instance_by_name">instance_by_name</a></li><li data-type='method'><a href="TorPool.html#instances_by_group">instances_by_group</a></li><li data-type='method'><a href="TorPool.html#new_identites">new_identites</a></li><li data-type='method'><a href="TorPool.html#new_identites_by_group">new_identites_by_group</a></li><li data-type='method'><a href="TorPool.html#new_identity_at">new_identity_at</a></li><li data-type='method'><a href="TorPool.html#new_identity_by_name">new_identity_by_name</a></li><li data-type='method'><a href="TorPool.html#next">next</a></li><li data-type='method'><a href="TorPool.html#next_by_group">next_by_group</a></li><li data-type='method'><a href="TorPool.html#remove">remove</a></li><li data-type='method'><a href="TorPool.html#remove_at">remove_at</a></li><li data-type='method'><a href="TorPool.html#remove_by_name">remove_by_name</a></li><li data-type='method'><a href="TorPool.html#remove_instance_from_group">remove_instance_from_group</a></li><li data-type='method'><a href="TorPool.html#remove_instance_from_group_at">remove_instance_from_group_at</a></li><li data-type='method'><a href="TorPool.html#remove_instance_from_group_by_name">remove_instance_from_group_by_name</a></li><li data-type='method'><a href="TorPool.html#set_config_all">set_config_all</a></li><li data-type='method'><a href="TorPool.html#set_config_at">set_config_at</a></li><li data-type='method'><a href="TorPool.html#set_config_by_group">set_config_by_group</a></li><li data-type='method'><a href="TorPool.html#set_config_by_name">set_config_by_name</a></li><li data-type='method'><a href="TorPool.html#signal_all">signal_all</a></li><li data-type='method'><a href="TorPool.html#signal_at">signal_at</a></li><li data-type='method'><a href="TorPool.html#signal_by_group">signal_by_group</a></li><li data-type='method'><a href="TorPool.html#signal_by_name">signal_by_name</a></li></ul></li><li><a href="TorProcess.html">TorProcess</a><ul class='methods'><li data-type='method'><a href="TorProcess.html#create">create</a></li><li data-type='method'><a href="TorProcess.html#exit">exit</a></li><li data-type='method'><a href="TorProcess.html#get_config">get_config</a></li><li data-type='method'><a href="TorProcess.html#new_identity">new_identity</a></li><li data-type='method'><a href="TorProcess.html#set_config">set_config</a></li><li data-type='method'><a href="TorProcess.html#signal">signal</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-tor-router.html">tor-router</a></li><li><a href="module-tor-router_ControlServer.html">tor-router/ControlServer</a></li><li><a href="module-tor-router_default_config.html">tor-router/default_config</a></li><li><a href="module-tor-router_default_ports.html">tor-router/default_ports</a></li><li><a href="module-tor-router_DNSServer.html">tor-router/DNSServer</a></li><li><a href="module-tor-router_HTTPServer.html">tor-router/HTTPServer</a></li><li><a href="module-tor-router_launch.html">tor-router/launch</a></li><li><a href="module-tor-router_nconf_load_env.html">tor-router/nconf_load_env</a></li><li><a href="module-tor-router_SOCKSServer.html">tor-router/SOCKSServer</a></li><li><a href="module-tor-router_TorPool.html">tor-router/TorPool</a></li><li><a href="module-tor-router_TorProcess.html">tor-router/TorProcess</a></li><li><a href="module-tor-router_winston_silent_logger.html">tor-router/winston_silent_logger</a></li></ul><h3>Events</h3><ul><li><a href="DNSServer.html#event:instance-connection">instance-connection</a></li><li><a href="HTTPServer.html#event:instance-connection">instance-connection</a></li><li><a href="SOCKSServer.html#event:instance-connection">instance-connection</a></li><li><a href="TorPool.html#event:instance_created">instance_created</a></li><li><a href="TorProcess.html#event:control_listen">control_listen</a></li><li><a href="TorProcess.html#event:controller_ready">controller_ready</a></li><li><a href="TorProcess.html#event:dns_listen">dns_listen</a></li><li><a href="TorProcess.html#event:error">error</a></li><li><a href="TorProcess.html#event:process_exit">process_exit</a></li><li><a href="TorProcess.html#event:ready">ready</a></li><li><a href="TorProcess.html#event:socks_listen">socks_listen</a></li></ul><h3>Global</h3><ul><li><a href="global.html#assembleHost">assembleHost</a></li><li><a href="global.html#cleanUp">cleanUp</a></li><li><a href="global.html#env_whitelist">env_whitelist</a></li><li><a href="global.html#logger">logger</a></li><li><a href="global.html#main">main</a></li><li><a href="global.html#nconf">nconf</a></li><li><a href="global.html#REALM">REALM</a></li><li><a href="global.html#setup_nconf_env">setup_nconf_env</a></li><li><a href="global.html#TOR_ROUTER_PROXY_AGENT">TOR_ROUTER_PROXY_AGENT</a></li></ul>
  23. </nav>
  24. <div id="main">
  25. <h1 class="page-title">ControlServer</h1>
  26. <section>
  27. <header>
  28. <h2>
  29. ControlServer
  30. </h2>
  31. <div class="class-description">A server which exposes an RPC interface that can control the application.</div>
  32. </header>
  33. <article>
  34. <div class="container-overview">
  35. <h2>Constructor</h2>
  36. <h4 class="name" id="ControlServer"><span class="type-signature"></span>new ControlServer<span class="signature">(nconf, logger<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
  37. <dl class="details">
  38. <dt class="tag-source">Source:</dt>
  39. <dd class="tag-source"><ul class="dummy"><li>
  40. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line25">line 25</a>
  41. </li></ul></dd>
  42. </dl>
  43. <h5>Parameters:</h5>
  44. <table class="params">
  45. <thead>
  46. <tr>
  47. <th>Name</th>
  48. <th>Type</th>
  49. <th>Attributes</th>
  50. <th class="last">Description</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. <tr>
  55. <td class="name"><code>nconf</code></td>
  56. <td class="type">
  57. <span class="param-type">Provider</span>
  58. </td>
  59. <td class="attributes">
  60. </td>
  61. <td class="description last">Instance of nconf.Provider that will be used to obtain configuration values.</td>
  62. </tr>
  63. <tr>
  64. <td class="name"><code>logger</code></td>
  65. <td class="type">
  66. <span class="param-type">Logger</span>
  67. </td>
  68. <td class="attributes">
  69. &lt;optional><br>
  70. </td>
  71. <td class="description last">Winston logger that will be used for logging. If not provided will disable logging.</td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. <h3 class="subsection-title">Members</h3>
  77. <h4 class="name" id="logger"><span class="type-signature"></span>logger<span class="type-signature"> :Logger</span></h4>
  78. <dl class="details">
  79. <dt class="tag-source">Source:</dt>
  80. <dd class="tag-source"><ul class="dummy"><li>
  81. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line43">line 43</a>
  82. </li></ul></dd>
  83. </dl>
  84. <div class="description">
  85. Winston Logger for logging
  86. </div>
  87. <h5>Type:</h5>
  88. <ul>
  89. <li>
  90. <span class="param-type">Logger</span>
  91. </li>
  92. </ul>
  93. <h4 class="name" id="nconf"><span class="type-signature"></span>nconf<span class="type-signature"> :Provider</span></h4>
  94. <dl class="details">
  95. <dt class="tag-source">Source:</dt>
  96. <dd class="tag-source"><ul class="dummy"><li>
  97. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line49">line 49</a>
  98. </li></ul></dd>
  99. </dl>
  100. <div class="description">
  101. Nconf Provider for configuration
  102. </div>
  103. <h5>Type:</h5>
  104. <ul>
  105. <li>
  106. <span class="param-type">Provider</span>
  107. </li>
  108. </ul>
  109. <h4 class="name" id="tor_pool"><span class="type-signature"></span>tor_pool<span class="type-signature"> :<a href="TorPool.html">TorPool</a></span></h4>
  110. <dl class="details">
  111. <dt class="tag-source">Source:</dt>
  112. <dd class="tag-source"><ul class="dummy"><li>
  113. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line37">line 37</a>
  114. </li></ul></dd>
  115. </dl>
  116. <div class="description">
  117. Pool of Tor instances
  118. </div>
  119. <h5>Type:</h5>
  120. <ul>
  121. <li>
  122. <span class="param-type"><a href="TorPool.html">TorPool</a></span>
  123. </li>
  124. </ul>
  125. <h3 class="subsection-title">Methods</h3>
  126. <h4 class="name" id=".instance_info"><span class="type-signature">(static) </span>instance_info<span class="signature">(instance)</span><span class="type-signature"> &rarr; {<a href="ControlServer.html#~InstanceInfo">ControlServer~InstanceInfo</a>}</span></h4>
  127. <dl class="details">
  128. <dt class="tag-source">Source:</dt>
  129. <dd class="tag-source"><ul class="dummy"><li>
  130. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line327">line 327</a>
  131. </li></ul></dd>
  132. </dl>
  133. <div class="description">
  134. Returns a summary of information on the running instance
  135. </div>
  136. <h5>Parameters:</h5>
  137. <table class="params">
  138. <thead>
  139. <tr>
  140. <th>Name</th>
  141. <th>Type</th>
  142. <th class="last">Description</th>
  143. </tr>
  144. </thead>
  145. <tbody>
  146. <tr>
  147. <td class="name"><code>instance</code></td>
  148. <td class="type">
  149. <span class="param-type"><a href="TorProcess.html">TorProcess</a></span>
  150. </td>
  151. <td class="description last"></td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. <h5>Returns:</h5>
  156. <dl class="param-type">
  157. <dt>
  158. Type
  159. </dt>
  160. <dd>
  161. <span class="param-type"><a href="ControlServer.html#~InstanceInfo">ControlServer~InstanceInfo</a></span>
  162. </dd>
  163. </dl>
  164. <h4 class="name" id="close"><span class="type-signature"></span>close<span class="signature">()</span><span class="type-signature"></span></h4>
  165. <dl class="details">
  166. <dt class="tag-source">Source:</dt>
  167. <dd class="tag-source"><ul class="dummy"><li>
  168. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line379">line 379</a>
  169. </li></ul></dd>
  170. </dl>
  171. <div class="description">
  172. Closes the TCP and/or WebSocket servers
  173. </div>
  174. <h4 class="name" id="createDNSServer"><span class="type-signature">(async) </span>createDNSServer<span class="signature">(port, hostname<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
  175. <dl class="details">
  176. <dt class="tag-source">Source:</dt>
  177. <dd class="tag-source"><ul class="dummy"><li>
  178. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line428">line 428</a>
  179. </li></ul></dd>
  180. </dl>
  181. <div class="description">
  182. Creates an instance of <a href="DNSServer.html">DNSServer</a> and begins listening for traffic
  183. </div>
  184. <h5>Parameters:</h5>
  185. <table class="params">
  186. <thead>
  187. <tr>
  188. <th>Name</th>
  189. <th>Type</th>
  190. <th>Attributes</th>
  191. <th class="last">Description</th>
  192. </tr>
  193. </thead>
  194. <tbody>
  195. <tr>
  196. <td class="name"><code>port</code></td>
  197. <td class="type">
  198. <span class="param-type">number</span>
  199. </td>
  200. <td class="attributes">
  201. </td>
  202. <td class="description last">Port the server should bind to</td>
  203. </tr>
  204. <tr>
  205. <td class="name"><code>hostname</code></td>
  206. <td class="type">
  207. <span class="param-type">string</span>
  208. </td>
  209. <td class="attributes">
  210. &lt;optional><br>
  211. </td>
  212. <td class="description last">Host the server should bind to</td>
  213. </tr>
  214. </tbody>
  215. </table>
  216. <h5>Returns:</h5>
  217. <dl class="param-type">
  218. <dt>
  219. Type
  220. </dt>
  221. <dd>
  222. <span class="param-type">Promise</span>
  223. </dd>
  224. </dl>
  225. <h4 class="name" id="createHTTPServer"><span class="type-signature">(async) </span>createHTTPServer<span class="signature">(port, hostname<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
  226. <dl class="details">
  227. <dt class="tag-source">Source:</dt>
  228. <dd class="tag-source"><ul class="dummy"><li>
  229. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line415">line 415</a>
  230. </li></ul></dd>
  231. </dl>
  232. <div class="description">
  233. Creates an instance of <a href="HTTPServer.html">HTTPServer</a> and begins listening for traffic
  234. </div>
  235. <h5>Parameters:</h5>
  236. <table class="params">
  237. <thead>
  238. <tr>
  239. <th>Name</th>
  240. <th>Type</th>
  241. <th>Attributes</th>
  242. <th class="last">Description</th>
  243. </tr>
  244. </thead>
  245. <tbody>
  246. <tr>
  247. <td class="name"><code>port</code></td>
  248. <td class="type">
  249. <span class="param-type">number</span>
  250. </td>
  251. <td class="attributes">
  252. </td>
  253. <td class="description last">Port the server should bind to</td>
  254. </tr>
  255. <tr>
  256. <td class="name"><code>hostname</code></td>
  257. <td class="type">
  258. <span class="param-type">string</span>
  259. </td>
  260. <td class="attributes">
  261. &lt;optional><br>
  262. </td>
  263. <td class="description last">Host the server should bind to</td>
  264. </tr>
  265. </tbody>
  266. </table>
  267. <h5>Returns:</h5>
  268. <dl class="param-type">
  269. <dt>
  270. Type
  271. </dt>
  272. <dd>
  273. <span class="param-type">Promise</span>
  274. </dd>
  275. </dl>
  276. <h4 class="name" id="createSOCKSServer"><span class="type-signature">(async) </span>createSOCKSServer<span class="signature">(port, hostname<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
  277. <dl class="details">
  278. <dt class="tag-source">Source:</dt>
  279. <dd class="tag-source"><ul class="dummy"><li>
  280. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line402">line 402</a>
  281. </li></ul></dd>
  282. </dl>
  283. <div class="description">
  284. Creates an instance of <a href="SOCKSServer.html">SOCKSServer</a> and begins listening for traffic
  285. </div>
  286. <h5>Parameters:</h5>
  287. <table class="params">
  288. <thead>
  289. <tr>
  290. <th>Name</th>
  291. <th>Type</th>
  292. <th>Attributes</th>
  293. <th class="last">Description</th>
  294. </tr>
  295. </thead>
  296. <tbody>
  297. <tr>
  298. <td class="name"><code>port</code></td>
  299. <td class="type">
  300. <span class="param-type">number</span>
  301. </td>
  302. <td class="attributes">
  303. </td>
  304. <td class="description last">Port the server should bind to</td>
  305. </tr>
  306. <tr>
  307. <td class="name"><code>hostname</code></td>
  308. <td class="type">
  309. <span class="param-type">string</span>
  310. </td>
  311. <td class="attributes">
  312. &lt;optional><br>
  313. </td>
  314. <td class="description last">Host the server should bind to</td>
  315. </tr>
  316. </tbody>
  317. </table>
  318. <h5>Returns:</h5>
  319. <dl class="param-type">
  320. <dt>
  321. Type
  322. </dt>
  323. <dd>
  324. <span class="param-type">Promise</span>
  325. </dd>
  326. </dl>
  327. <h4 class="name" id="createTorPool"><span class="type-signature"></span>createTorPool<span class="signature">(tor_config<span class="signature-attributes">opt</span>, load_balance_method<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="TorPool.html">TorPool</a>}</span></h4>
  328. <dl class="details">
  329. <dt class="tag-source">Source:</dt>
  330. <dd class="tag-source"><ul class="dummy"><li>
  331. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line390">line 390</a>
  332. </li></ul></dd>
  333. </dl>
  334. <div class="description">
  335. Creates a new <a href="TorPool.html">TorPool</a> instance
  336. </div>
  337. <h5>Parameters:</h5>
  338. <table class="params">
  339. <thead>
  340. <tr>
  341. <th>Name</th>
  342. <th>Type</th>
  343. <th>Attributes</th>
  344. <th class="last">Description</th>
  345. </tr>
  346. </thead>
  347. <tbody>
  348. <tr>
  349. <td class="name"><code>tor_config</code></td>
  350. <td class="type">
  351. <span class="param-type">Object</span>
  352. </td>
  353. <td class="attributes">
  354. &lt;optional><br>
  355. </td>
  356. <td class="description last">Default Tor config to be used for the pool of instances.</td>
  357. </tr>
  358. <tr>
  359. <td class="name"><code>load_balance_method</code></td>
  360. <td class="type">
  361. <span class="param-type">string</span>
  362. </td>
  363. <td class="attributes">
  364. &lt;optional><br>
  365. </td>
  366. <td class="description last">Load balance method to be used for the pool. Will default to the global configuration if not provided.</td>
  367. </tr>
  368. </tbody>
  369. </table>
  370. <h5>Returns:</h5>
  371. <div class="param-desc">
  372. - The <a href="TorPool.html">TorPool</a> that was created.
  373. </div>
  374. <dl class="param-type">
  375. <dt>
  376. Type
  377. </dt>
  378. <dd>
  379. <span class="param-type"><a href="TorPool.html">TorPool</a></span>
  380. </dd>
  381. </dl>
  382. <h4 class="name" id="listen"><span class="type-signature">(async) </span>listen<span class="signature">(port, hostname<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
  383. <dl class="details">
  384. <dt class="tag-source">Source:</dt>
  385. <dd class="tag-source"><ul class="dummy"><li>
  386. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line374">line 374</a>
  387. </li></ul></dd>
  388. </dl>
  389. <div class="description">
  390. Calls <a href="ControlServer.html#listenTcp">ControlServer#listenTcp</a> with the same arguments
  391. </div>
  392. <h5>Parameters:</h5>
  393. <table class="params">
  394. <thead>
  395. <tr>
  396. <th>Name</th>
  397. <th>Type</th>
  398. <th>Attributes</th>
  399. <th class="last">Description</th>
  400. </tr>
  401. </thead>
  402. <tbody>
  403. <tr>
  404. <td class="name"><code>port</code></td>
  405. <td class="type">
  406. <span class="param-type">number</span>
  407. </td>
  408. <td class="attributes">
  409. </td>
  410. <td class="description last">Port the server should bind to</td>
  411. </tr>
  412. <tr>
  413. <td class="name"><code>hostname</code></td>
  414. <td class="type">
  415. <span class="param-type">string</span>
  416. </td>
  417. <td class="attributes">
  418. &lt;optional><br>
  419. </td>
  420. <td class="description last">Host the server should bind to</td>
  421. </tr>
  422. </tbody>
  423. </table>
  424. <h5>Returns:</h5>
  425. <dl class="param-type">
  426. <dt>
  427. Type
  428. </dt>
  429. <dd>
  430. <span class="param-type">Promise</span>
  431. </dd>
  432. </dl>
  433. <h4 class="name" id="listenTcp"><span class="type-signature">(async) </span>listenTcp<span class="signature">(port, hostname<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
  434. <dl class="details">
  435. <dt class="tag-source">Source:</dt>
  436. <dd class="tag-source"><ul class="dummy"><li>
  437. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line346">line 346</a>
  438. </li></ul></dd>
  439. </dl>
  440. <div class="description">
  441. Binds the server to a host and port and begins listening for TCP traffic
  442. </div>
  443. <h5>Parameters:</h5>
  444. <table class="params">
  445. <thead>
  446. <tr>
  447. <th>Name</th>
  448. <th>Type</th>
  449. <th>Attributes</th>
  450. <th class="last">Description</th>
  451. </tr>
  452. </thead>
  453. <tbody>
  454. <tr>
  455. <td class="name"><code>port</code></td>
  456. <td class="type">
  457. <span class="param-type">number</span>
  458. </td>
  459. <td class="attributes">
  460. </td>
  461. <td class="description last">Port the server should bind to</td>
  462. </tr>
  463. <tr>
  464. <td class="name"><code>hostname</code></td>
  465. <td class="type">
  466. <span class="param-type">string</span>
  467. </td>
  468. <td class="attributes">
  469. &lt;optional><br>
  470. </td>
  471. <td class="description last">Host the server should bind to</td>
  472. </tr>
  473. </tbody>
  474. </table>
  475. <h5>Returns:</h5>
  476. <dl class="param-type">
  477. <dt>
  478. Type
  479. </dt>
  480. <dd>
  481. <span class="param-type">Promise</span>
  482. </dd>
  483. </dl>
  484. <h4 class="name" id="listenWs"><span class="type-signature">(async) </span>listenWs<span class="signature">(port, hostname<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
  485. <dl class="details">
  486. <dt class="tag-source">Source:</dt>
  487. <dd class="tag-source"><ul class="dummy"><li>
  488. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line360">line 360</a>
  489. </li></ul></dd>
  490. </dl>
  491. <div class="description">
  492. Binds the server to a host and port and begins listening for WebSocket traffic
  493. </div>
  494. <h5>Parameters:</h5>
  495. <table class="params">
  496. <thead>
  497. <tr>
  498. <th>Name</th>
  499. <th>Type</th>
  500. <th>Attributes</th>
  501. <th class="last">Description</th>
  502. </tr>
  503. </thead>
  504. <tbody>
  505. <tr>
  506. <td class="name"><code>port</code></td>
  507. <td class="type">
  508. <span class="param-type">number</span>
  509. </td>
  510. <td class="attributes">
  511. </td>
  512. <td class="description last">Port the server should bind to</td>
  513. </tr>
  514. <tr>
  515. <td class="name"><code>hostname</code></td>
  516. <td class="type">
  517. <span class="param-type">string</span>
  518. </td>
  519. <td class="attributes">
  520. &lt;optional><br>
  521. </td>
  522. <td class="description last">Host the server should bind to</td>
  523. </tr>
  524. </tbody>
  525. </table>
  526. <h5>Returns:</h5>
  527. <dl class="param-type">
  528. <dt>
  529. Type
  530. </dt>
  531. <dd>
  532. <span class="param-type">Promise</span>
  533. </dd>
  534. </dl>
  535. <h3 class="subsection-title">Type Definitions</h3>
  536. <h4 class="name" id="~InstanceInfo">InstanceInfo</h4>
  537. <dl class="details">
  538. <dt class="tag-source">Source:</dt>
  539. <dd class="tag-source"><ul class="dummy"><li>
  540. <a href="ControlServer.js.html">ControlServer.js</a>, <a href="ControlServer.js.html#line10">line 10</a>
  541. </li></ul></dd>
  542. </dl>
  543. <h5 class="subsection-title">Properties:</h5>
  544. <table class="props">
  545. <thead>
  546. <tr>
  547. <th>Name</th>
  548. <th>Type</th>
  549. <th>Attributes</th>
  550. <th class="last">Description</th>
  551. </tr>
  552. </thead>
  553. <tbody>
  554. <tr>
  555. <td class="name"><code>name</code></td>
  556. <td class="type">
  557. <span class="param-type">string</span>
  558. </td>
  559. <td class="attributes">
  560. </td>
  561. <td class="description last">Name of the instance.</td>
  562. </tr>
  563. <tr>
  564. <td class="name"><code>group</code></td>
  565. <td class="type">
  566. <span class="param-type"><a href="Array.html">Array</a>.&lt;string></span>
  567. </td>
  568. <td class="attributes">
  569. </td>
  570. <td class="description last">Groups the instance belongs to.</td>
  571. </tr>
  572. <tr>
  573. <td class="name"><code>dns_port</code></td>
  574. <td class="type">
  575. <span class="param-type">number</span>
  576. </td>
  577. <td class="attributes">
  578. </td>
  579. <td class="description last">Port Tor is listening on for DNS Traffic.</td>
  580. </tr>
  581. <tr>
  582. <td class="name"><code>socks_port</code></td>
  583. <td class="type">
  584. <span class="param-type">number</span>
  585. </td>
  586. <td class="attributes">
  587. </td>
  588. <td class="description last">Port Tor is listening on for SOCKS Traffic.</td>
  589. </tr>
  590. <tr>
  591. <td class="name"><code>process_id</code></td>
  592. <td class="type">
  593. <span class="param-type">number</span>
  594. </td>
  595. <td class="attributes">
  596. </td>
  597. <td class="description last">Process ID for the Tor process.</td>
  598. </tr>
  599. <tr>
  600. <td class="name"><code>config</code></td>
  601. <td class="type">
  602. <span class="param-type">Object</span>
  603. </td>
  604. <td class="attributes">
  605. </td>
  606. <td class="description last">Configuration (torrc) set when starting the process.</td>
  607. </tr>
  608. <tr>
  609. <td class="name"><code>weight</code></td>
  610. <td class="type">
  611. <span class="param-type">number</span>
  612. </td>
  613. <td class="attributes">
  614. &lt;optional><br>
  615. </td>
  616. <td class="description last">Weight of the instance for weighted load balancing.</td>
  617. </tr>
  618. </tbody>
  619. </table>
  620. </article>
  621. </section>
  622. </div>
  623. <br class="clear">
  624. <footer>
  625. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Sep 25 2018 12:53:23 GMT-0400 (Eastern Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
  626. </footer>
  627. <script>prettyPrint();</script>
  628. <script src="scripts/linenumber.js"></script>
  629. </body>
  630. </html>