aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
diff options
context:
space:
mode:
authorhrxi <hrrrxi@gmail.com>2019-12-28 03:11:51 +0100
committerfiaxh <git@lightrise.org>2021-03-19 22:06:02 +0100
commit148cf48d2b68354881066e2587e2673c91d2619a (patch)
tree623c2eda8dda8d327084b36bc74120933be061bf /xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
parente70b7c1222506a881b4166c67803c467e1985bbc (diff)
downloaddino-148cf48d2b68354881066e2587e2673c91d2619a.tar.gz
dino-148cf48d2b68354881066e2587e2673c91d2619a.zip
Add libnice and listen for direct connections in Jingle SOCKS5 (#608)
Add libnice as a plugin. If it is present, use libnice to enumerate local IP addresses and listen on them to support direct connections for Jingle SOCKS5. Tested with Conversations and Gajim. Created the nice.vapi file using ``` vapigen --library nice --pkg gio-2.0 --metadatadir metadata /usr/share/gir-1.0/Nice-0.1.gir ```
Diffstat (limited to 'xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala')
-rw-r--r--xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala17
1 files changed, 15 insertions, 2 deletions
diff --git a/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala b/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
index fdee2411..c184877c 100644
--- a/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
+++ b/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
@@ -18,21 +18,34 @@ public class Proxy : Object {
}
}
+public delegate Gee.List<string> GetLocalIpAddresses();
+
public class Module : XmppStreamModule, Iq.Handler {
public static Xmpp.ModuleIdentity<Module> IDENTITY = new Xmpp.ModuleIdentity<Module>(NS_URI, "0065_socks5_bytestreams");
+ private GetLocalIpAddresses? get_local_ip_addresses_impl = null;
+
public override void attach(XmppStream stream) {
stream.add_flag(new Flag());
query_availability.begin(stream);
}
public override void detach(XmppStream stream) { }
- public async void on_iq_set(XmppStream stream, Iq.Stanza iq) { }
-
public Gee.List<Proxy> get_proxies(XmppStream stream) {
return stream.get_flag(Flag.IDENTITY).proxies;
}
+ public void set_local_ip_address_handler(owned GetLocalIpAddresses get_local_ip_addresses) {
+ get_local_ip_addresses_impl = (owned)get_local_ip_addresses;
+ }
+
+ public Gee.List<string> get_local_ip_addresses() {
+ if (get_local_ip_addresses_impl == null) {
+ return Gee.List.empty();
+ }
+ return get_local_ip_addresses_impl();
+ }
+
private async void query_availability(XmppStream stream) {
ServiceDiscovery.ItemsResult? items_result = yield stream.get_module(ServiceDiscovery.Module.IDENTITY).request_items(stream, stream.remote_name);
if (items_result == null) return;