[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #5454 [Stem]: ExitPolicy Class for stem



#5454: ExitPolicy Class for stem
-------------------------+--------------------------------------------------
 Reporter:  gsathya      |          Owner:  atagar           
     Type:  enhancement  |         Status:  needs_information
 Priority:  normal       |      Milestone:                   
Component:  Stem         |        Version:                   
 Keywords:               |         Parent:                   
   Points:               |   Actualpoints:                   
-------------------------+--------------------------------------------------

Comment(by gsathya):

 > What we want from this ticket is this:
 > A class that represents an exit policy, which we can use to see 'can I
 exit to this ip/port'

 From what I can understand, this isn't possible with the microdescriptor
 exit policy because it only contains a list of ports.

 I prefer having a common API for both the exit policies and we can have a
 ExitPolicy.convert_to_microdescriptor_policy()(or sth with a better name)
 to create the list of a ports in the format specified by the microdesc
 exit policy summary spec.
 There's no point in having another class for this.

 This common API can be -
 {{{
 >>> exit_policies = stem.exit_policy.ExitPolicy()
 >>> exit_policies.add("accept *:80")
 >>> exit_policies.add("accept *:443")
 >>> exit_policies.add("reject *:*")
 >>> print exit_policies
 accept *:80 , accept *:443, reject *:*
 >>> print exit_policies.convert_to_mircodesc_policy()
 accept 80, 443
 >>> exit_policies.check("74.125.236.176", "80")
 True
 >>> exit_policies.check("74.125.236.176", "22")
 False
 }}}

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/5454#comment:13>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs