Class: Onion::Router
- Inherits:
-
Object
- Object
- Onion::Router
- Defined in:
- lib/onion/elements/router.rb
Overview
Onion::Router is a Ruby object representing a Tor router.
Instance Attribute Summary collapse
-
#fingerprint ⇒ Object
readonly
Returns the value of attribute fingerprint.
-
#nick ⇒ Object
readonly
Returns the value of attribute nick.
-
#status_flags ⇒ Object
readonly
Returns the value of attribute status_flags.
Instance Method Summary collapse
-
#exit? ⇒ Boolean
Returns true if the router is an exit router, false otherwise.
-
#guard? ⇒ Boolean
Returns true if the rotuer is a guard router, false otherwise.
-
#initialize(nick, fingerprint, status_flags) ⇒ Router
constructor
A new instance of Router.
Constructor Details
#initialize(nick, fingerprint, status_flags) ⇒ Router
Returns a new instance of Router.
5 6 7 8 9 |
# File 'lib/onion/elements/router.rb', line 5 def initialize(nick, fingerprint, status_flags) @nick = nick # Nickname of the router. @fingerprint = fingerprint # Fingerprint of the router. @status_flags = status_flags # Array of strings with status flags. end |
Instance Attribute Details
#fingerprint ⇒ Object (readonly)
Returns the value of attribute fingerprint.
4 5 6 |
# File 'lib/onion/elements/router.rb', line 4 def fingerprint @fingerprint end |
#nick ⇒ Object (readonly)
Returns the value of attribute nick.
4 5 6 |
# File 'lib/onion/elements/router.rb', line 4 def nick @nick end |
#status_flags ⇒ Object (readonly)
Returns the value of attribute status_flags.
4 5 6 |
# File 'lib/onion/elements/router.rb', line 4 def status_flags @status_flags end |
Instance Method Details
#exit? ⇒ Boolean
Returns true if the router is an exit router, false otherwise.
17 18 19 |
# File 'lib/onion/elements/router.rb', line 17 def exit? @status_flags and @status_flags.include?("Exit") end |
#guard? ⇒ Boolean
Returns true if the rotuer is a guard router, false otherwise.
12 13 14 |
# File 'lib/onion/elements/router.rb', line 12 def guard? @status_flags and @status_flags.include?("Guard") end |