[tor-commits] [stem/master] Support non-anonymous ADD_ONION services

atagar at torproject.org atagar at torproject.org
Tue Sep 13 16:37:36 UTC 2016


commit 3d0e999f8073bed67d84bb863560078e923a8b57
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Sep 13 09:26:38 2016 -0700

    Support non-anonymous ADD_ONION services
    
    Adding support for ADD_ONION's new NonAnonymous flag.
---
 docs/change_log.rst |  1 +
 stem/control.py     | 11 ++++++++++-
 stem/version.py     |  2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 4857b04..7ae3466 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -50,6 +50,7 @@ The following are only available within Stem's `git repository
   * :class:`~stem.exit_policy.ExitPolicy` support for *accept6/reject6* and *\*4/6* wildcards (:trac:`16053`)
   * Added `support for NETWORK_LIVENESS events <api/response.html#stem.response.events.NetworkLivenessEvent>`_ (:spec:`44aac63`)
   * Added support for basic authentication to :func:`~stem.control.Controller.create_ephemeral_hidden_service` (:spec:`c2865d9`)
+  * Added support for non-anonymous services to :func:`~stem.control.Controller.create_ephemeral_hidden_service` (:spec:`b8fe774`)
   * Added :func:`~stem.control.event_description` for getting human-friendly descriptions of tor events (:trac:`19061`)
   * Added :func:`~stem.control.Controller.reconnect` to the :class:`~stem.control.Controller`
   * Added :func:`~stem.control.Controller.is_set` to the :class:`~stem.control.Controller`
diff --git a/stem/control.py b/stem/control.py
index 9b98758..dfa5add 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -2827,6 +2827,9 @@ class Controller(BaseController):
     .. versionchanged:: 1.5.0
        Added the basic_auth argument.
 
+    .. versionchanged:: 1.5.0
+       Added support for non-anonymous services.
+
     :param int,list,dict ports: hidden service port(s) or mapping of hidden
       service ports to their targets
     :param str key_type: type of key being provided, generates a new key if
@@ -2873,6 +2876,10 @@ class Controller(BaseController):
 
       flags.append('BasicAuth')
 
+    if self.get_version() >= stem.version.Requirement.ADD_ONION_NON_ANONYMOUS:
+      if self.get_conf('HiddenServiceSingleHopMode', None) == '1' and self.get_conf('HiddenServiceNonAnonymousMode', None) == '1':
+        flags.append('NonAnonymous')
+
     if flags:
       request += ' Flags=%s' % ','.join(flags)
 
@@ -3533,7 +3540,9 @@ class Controller(BaseController):
 
     :param stem.Signal signal: type of signal to be sent
 
-    :raises: :class:`stem.InvalidArguments` if signal provided wasn't recognized
+    :raises:
+      * :class:`stem.ControllerError` if sending the signal failed
+      * :class:`stem.InvalidArguments` if signal provided wasn't recognized
     """
 
     response = self.msg('SIGNAL %s' % signal)
diff --git a/stem/version.py b/stem/version.py
index e13c420..6f7e514 100644
--- a/stem/version.py
+++ b/stem/version.py
@@ -59,6 +59,7 @@ easily parsed and compared, for instance...
   **HSPOST**                            HSPOST requests
   **ADD_ONION**                         ADD_ONION and DEL_ONION requests
   **ADD_ONION_BASIC_AUTH**              ADD_ONION supports basic authentication
+  **ADD_ONION_NON_ANONYMOUS**           ADD_ONION supports non-anonymous mode
   **LOADCONF**                          LOADCONF requests
   **MICRODESCRIPTOR_IS_DEFAULT**        Tor gets microdescriptors by default rather than server descriptors
   **TAKEOWNERSHIP**                     TAKEOWNERSHIP requests
@@ -366,6 +367,7 @@ Requirement = stem.util.enum.Enum(
   ('HSPOST', Version('0.2.7.1-alpha')),
   ('ADD_ONION', Version('0.2.7.1-alpha')),
   ('ADD_ONION_BASIC_AUTH', Version('0.2.9.1-alpha')),
+  ('ADD_ONION_NON_ANONYMOUS', Version('0.2.9.3-alpha')),
   ('LOADCONF', Version('0.2.1.1')),
   ('MICRODESCRIPTOR_IS_DEFAULT', Version('0.2.3.3')),
   ('TAKEOWNERSHIP', Version('0.2.2.28-beta')),





More information about the tor-commits mailing list