[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #12088 [Pluggable transport]: goptlib should provide a method for querying the state location.
#12088: goptlib should provide a method for querying the state location.
-------------------------------------+------------------------------
Reporter: yawning | Owner: dcf
Type: enhancement | Status: needs_review
Priority: normal | Milestone:
Component: Pluggable transport | Version:
Resolution: | Keywords: goptlib, library
Actual Points: | Parent ID:
Points: |
-------------------------------------+------------------------------
Comment (by yawning):
Replying to [comment:6 dcf]:
> Replying to [comment:5 yawning]:
> > I took your API/implementation and wrote the unit tests for it. For
the #6 test I did what path_test did and made sure that creating a
subdirectory of a file fails.
>
> Thank you very much. Can you also make a patch showing how this API
would be used in obfs4? I don't want it to be too cumbersome over
ClientInfo.StateLocation.
Something like this:
{{{
-func ptInitializeLogging(enable bool) {
+func ptInitializeLogging(enable bool) error {
if enable {
- dir, err := ptGetStateDir()
- if err != nil || dir == "" {
- return
+ // pt.MakeStateDir will ENV-ERROR for us.
+ dir, err := pt.MakeStateDir()
+ if err != nil {
+ return err
}
+ // While we could just exit, log an ENV-ERROR so it will
propagate to
+ // the tor log.
f, err := os.OpenFile(path.Join(dir, obfs4LogFile),
os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
- log.Fatalf("[ERROR] Failed to open log file: %s",
err)
+ envError := []byte(fmt.Sprintf("ENV-ERROR Failed
to open log file: %s", err))
+ pt.Stdout.Write(envError)
+ return err
}
log.SetOutput(f)
} else {
log.SetOutput(ioutil.Discard)
}
+
+ return nil
}
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12088#comment:7>
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