Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Add Psiphon censorship circumvention test #1425

Closed
anadahz opened this issue Oct 10, 2017 · 7 comments
Closed

Add Psiphon censorship circumvention test #1425

anadahz opened this issue Oct 10, 2017 · 7 comments

Comments

@anadahz
Copy link
Contributor

anadahz commented Oct 10, 2017

This test should measure whether Psiphon is working and bootstrap successfully from the given network vantage point.

@hellais
Copy link
Contributor

hellais commented Oct 10, 2017

The ooni-probe ticket has a bunch of information on how we would do this: https://github.com/TheTorProject/ooni-probe/issues/744

@hellais
Copy link
Contributor

hellais commented Dec 30, 2017

To discuss:

  • have a way to build psiphon as a shared static library with PIC flags enabled
  • ensure exit is done only in unrecoverable cases
  • define the Psiphon exported function that is to be called by mk and ensure it’s stable (i.e. a stable APi for start, stop and get status)

@hellais
Copy link
Contributor

hellais commented Dec 30, 2017

cc @mirokuratczyk @bassosimone

@joelanders
Copy link
Contributor

joelanders commented Jan 26, 2018

I may have figured out a few things about compiling + linking + calling Psiphon from C, so I'm writing them down here.

Here's some sample code where I start Psiphon from C, passing in a C function that gets called on some Psiphon bootstrapping (etc.) events that we want to look for.

Psiphon-Labs/psiphon-tunnel-core@master...joelanders:call-psiphon-from-c

gcc -o libnotice_handler.a -c libnotice_handler.c
go build -buildmode=c-archive -o psi.a psi.go
gcc -o test test.c psi.a -lpthread -I. -L. -lnotice_handler
l@nl2 ~/golang/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/psi [master] $ ./test
{"data":{"regions":["AT","BE","BG","CA","CH","CZ","DE","ES","FR","GB","IN","JP","NL","RO","SE","SG","US"]},"noticeType":"AvailableEgressRegions","showUser":false,"timestamp":"2018-01-26T18:56:59.172Z"}
{"data":{"port":39227},"noticeType":"ListeningSocksProxyPort","showUser":false,"timestamp":"2018-01-26T18:56:59.183Z"}
{"data":{"port":33009},"noticeType":"ListeningHttpProxyPort","showUser":false,"timestamp":"2018-01-26T18:56:59.184Z"}
{"data":{"region":"NL"},"noticeType":"ClientRegion","showUser":false,"timestamp":"2018-01-26T18:56:59.565Z"}
{"data":{"url":"https://urldirector.net/?sponsor=psiphon_bbg\u0026client_region=NL\u0026client_platform=windows\u0026secret=[deleted]"},"noticeType":"Homepage","showUser":false,"timestamp":"2018-01-26T18:56:59.580Z"}
{"data":{"version":"132"},"noticeType":"ClientUpgradeAvailable","showUser":false,"timestamp":"2018-01-26T18:56:59.580Z"}
{"data":{"timestamp":"2018-01-26T18:56:59Z"},"noticeType":"ServerTimestamp","showUser":false,"timestamp":"2018-01-26T18:56:59.580Z"}
{"data":{"count":1},"noticeType":"Tunnels","showUser":false,"timestamp":"2018-01-26T18:56:59.581Z"}
^C

(you'll need a config file, and don't forget the CFLAGS in psi.go)

Maybe some of the building/linking can be simplified, but this is the simplest thing I got to work. I'm guessing the remainder of the work looks like:

  • write a "notice" event handler that appends the JSON strings to the report
  • calls Start() in a new thread
  • waits for the "noticeType":"Tunnels" event which tells us when the bootstrapping is done
  • calls Stop()

@bassosimone
Copy link
Member

We've done work in this direction. It seems having a static -fPIC library that we can use on mobile is a hassle, and using gomobile would be better. This means that we'll use gomobile for generating mobile libraries for Psiphon, and that we need to be able to run tests written in the platform target language (i.e. ObjectiveC in iOS; Java in Android). See also #1690

@bassosimone
Copy link
Member

Moving to v0.11.0. Some work to this end will land in v0.10.0, tho.

@bassosimone
Copy link
Member

This issue will never be completed as part of this repository. We have determined that it is much simpler for us to write this functionality in Go. See:

https://github.com/measurement-kit/engine/projects/1

As such, this issue can now be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants