[tor-bugs] #12087 [Pluggable transport]: goptlib could provide IsClient()/IsServer().
Tor Bug Tracker & Wiki
blackhole at torproject.org
Sun May 25 18:09:11 UTC 2014
#12087: goptlib could provide IsClient()/IsServer().
-------------------------------------+------------------------------
Reporter: yawning | Owner: asn
Type: enhancement | Status: needs_review
Priority: minor | Milestone:
Component: Pluggable transport | Version:
Resolution: | Keywords: goptlib, library
Actual Points: | Parent ID:
Points: |
-------------------------------------+------------------------------
Comment (by dcf):
Replying to [comment:3 yawning]:
> How about something like:
> {{{
> type ManagedMode int
>
> const (
> ManagedClient ManagedMode = iota
> ManagedServer
> )
>
> func ManagedMode() (ManagedMode, error) {
> // Examine both client and server transports to handle pathological
inputs, EnvError as appropriate.
> }
> }}}
>
> That would let ManagedMode() examine all the things that should be
tested and do error handling.
This way doesn't feel good to me. Now you're two layers of abstraction
deep, you've got these new named magic constants, you still have this tri-
state processing (client, server, error).
I may not have been clear in comment:2. I don't actually think we should
have extensive, disciplinarian error handling. ("Ha! You defined both
variables at once! Thought you could pull a fast one, did you?") I just
meant that we need to include all possible cases as tests, not that we
need to start throwing a lot of errors. It's 100% okay with me if "both
variables defined" ⇒ client mode, and "no variables defined" ⇒ server
mode, with no possible error condition. ClientSetup and ServerSetup have
to do real error checking anyway; all you're looking for is a hint as to
which one to call.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12087#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list