// Java Package psi is a proxy for talking to a Go program. // gobind -lang=java github.com/Psiphon-Labs/psiphon-tunnel-core/AndroidLibrary/psi // // File is generated by gobind. Do not edit. package go.psi; import go.Seq; public abstract class Psi { private Psi() {} // uninstantiable public interface PsiphonProvider extends go.Seq.Object { public void BindToDevice(long fileDescriptor) throws Exception; public String GetDnsServer(); public long HasNetworkConnectivity(); public void Notice(String noticeJSON); public static abstract class Stub implements PsiphonProvider { static final String DESCRIPTOR = "go.psi.PsiphonProvider"; private final go.Seq.Ref ref; public Stub() { ref = go.Seq.createRef(this); } public go.Seq.Ref ref() { return ref; } public void call(int code, go.Seq in, go.Seq out) { switch (code) { case Proxy.CALL_BindToDevice: { long param_fileDescriptor = in.readInt(); try { this.BindToDevice(param_fileDescriptor); out.writeUTF16(null); } catch (Exception e) { out.writeUTF16(e.getMessage()); } return; } case Proxy.CALL_GetDnsServer: { String result = this.GetDnsServer(); out.writeUTF16(result); return; } case Proxy.CALL_HasNetworkConnectivity: { long result = this.HasNetworkConnectivity(); out.writeInt(result); return; } case Proxy.CALL_Notice: { String param_noticeJSON = in.readUTF16(); this.Notice(param_noticeJSON); return; } default: throw new RuntimeException("unknown code: "+ code); } } } static final class Proxy implements PsiphonProvider { static final String DESCRIPTOR = Stub.DESCRIPTOR; private go.Seq.Ref ref; Proxy(go.Seq.Ref ref) { this.ref = ref; } public go.Seq.Ref ref() { return ref; } public void call(int code, go.Seq in, go.Seq out) { throw new RuntimeException("cycle: cannot call proxy"); } public void BindToDevice(long fileDescriptor) throws Exception { go.Seq _in = new go.Seq(); go.Seq _out = new go.Seq(); _in.writeRef(ref); _in.writeInt(fileDescriptor); Seq.send(DESCRIPTOR, CALL_BindToDevice, _in, _out); String _err = _out.readUTF16(); if (_err != null) { throw new Exception(_err); } } public String GetDnsServer() { go.Seq _in = new go.Seq(); go.Seq _out = new go.Seq(); String _result; _in.writeRef(ref); Seq.send(DESCRIPTOR, CALL_GetDnsServer, _in, _out); _result = _out.readUTF16(); return _result; } public long HasNetworkConnectivity() { go.Seq _in = new go.Seq(); go.Seq _out = new go.Seq(); long _result; _in.writeRef(ref); Seq.send(DESCRIPTOR, CALL_HasNetworkConnectivity, _in, _out); _result = _out.readInt(); return _result; } public void Notice(String noticeJSON) { go.Seq _in = new go.Seq(); go.Seq _out = new go.Seq(); _in.writeRef(ref); _in.writeUTF16(noticeJSON); Seq.send(DESCRIPTOR, CALL_Notice, _in, _out); } static final int CALL_BindToDevice = 0x10a; static final int CALL_GetDnsServer = 0x20a; static final int CALL_HasNetworkConnectivity = 0x30a; static final int CALL_Notice = 0x40a; } } public static void Start(String configJson, String embeddedServerEntryList, PsiphonProvider provider) throws Exception { go.Seq _in = new go.Seq(); go.Seq _out = new go.Seq(); _in.writeUTF16(configJson); _in.writeUTF16(embeddedServerEntryList); _in.writeRef(provider.ref()); Seq.send(DESCRIPTOR, CALL_Start, _in, _out); String _err = _out.readUTF16(); if (_err != null) { throw new Exception(_err); } } public static void Stop() { go.Seq _in = new go.Seq(); go.Seq _out = new go.Seq(); Seq.send(DESCRIPTOR, CALL_Stop, _in, _out); } private static final int CALL_Start = 1; private static final int CALL_Stop = 2; private static final String DESCRIPTOR = "psi"; }