guardianproject / AndroidPluggableTransports

Android Pluggable Transports (aka PLUTO2)
https://www.pluggabletransports.info/
Other
28 stars 15 forks source link

obfs4proxy.go crash on opening socket #10

Open n8fr8 opened 6 years ago

n8fr8 commented 6 years ago

When I connect to the obfs4proxy/meek_list instance local socks port to configure it (https://github.com/guardianproject/AndroidPluggableTransports/blob/master/APTDispatchLibrary-MeekObfs4-Full/src/main/java/info/pluggabletransports/dispatch/transports/MeekTransport.java#L113), the crash below happens

05-08 22:33:22.234 20763-0/info.pluggabletransports.sample E/Go: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7678ff5034] goroutine 20 [running]: gitlab.com/pluggable-transports/goptbundle/obfs4proxy.(*termMonitor).onHandlerStart(...) /home/hans/go/src/gitlab.com/pluggable-transports/goptbundle/obfs4proxy/termmon.go:51 gitlab.com/pluggable-transports/goptbundle/obfs4proxy.clientHandler(0x767912a4a0, 0x442013e0a0, 0x767912b800, 0x4420140010, 0x0) /home/hans/go/src/gitlab.com/pluggable-transports/goptbundle/obfs4proxy/obfs4proxy.go:140 +0x54 created by gitlab.com/pluggable-transports/goptbundle/obfs4proxy.clientAcceptLoop 05-08 22:33:22.235 20763-0/info.pluggabletransports.sample E/Go: /home/hans/go/src/gitlab.com/pluggable-transports/goptbundle/obfs4proxy/obfs4proxy.go:134 +0x10c 05-08 22:33:22.235 20763-20839/info.pluggabletransports.sample A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 20839 (AsyncTask #1), pid 20763 (ansports.sample)

n8fr8 commented 6 years ago

I found the issue... in your new Load() method, you don't call the "// Initialize the termination state monitor as soon as possible. termMon = newTermMonitor()"

that is in the Main() code

eighthave commented 6 years ago

I was assuming that the term monitor thing was for running as a executable. Try adding it back in and see what happens. To really turn this into a proper library, I think we'll need some help from someone who actually knows Go.