+ printf ("Proxies for URI '%s' are:\n", info);
+ run_with_enumerator (synchronous, enumerator);
+
+ g_object_unref (enumerator);
+}
+
+static void
+use_inet_address (gboolean synchronous)
+{
+ GSocketAddressEnumerator *enumerator;
+ GSocketAddress *sockaddr;
+ GInetAddress *addr;
+ guint port = 0;
+ gchar **ip_and_port;
+
+ ip_and_port = g_strsplit (info, ":", 2);
+
+ if (ip_and_port[0])
+ {
+ addr = g_inet_address_new_from_string (ip_and_port[0]);
+ if (ip_and_port [1])
+ port = strtoul (ip_and_port [1], NULL, 10);
+ }
+
+ g_strfreev (ip_and_port);
+
+ if (addr == NULL || port <= 0 || port >= 65535)
+ {
+ fprintf (stderr, "Bad 'ip:port' parameter '%s'\n", info);
+ if (addr)
+ g_object_unref (addr);
+ return_value = 1;
+ return;
+ }
+
+ sockaddr = g_inet_socket_address_new (addr, port);
+ g_object_unref (addr);
+
+ enumerator =
+ g_socket_connectable_proxy_enumerate (G_SOCKET_CONNECTABLE (sockaddr));
+ g_object_unref (sockaddr);
+
+ printf ("Proxies for ip and port '%s' are:\n", info);
+ run_with_enumerator (synchronous, enumerator);
+
+ g_object_unref (enumerator);
+}
+
+#ifdef G_OS_UNIX
+static void
+use_unix_address (gboolean synchronous)
+{
+ GSocketAddressEnumerator *enumerator;
+ GSocketAddress *sockaddr;
+
+ sockaddr = g_unix_socket_address_new_abstract (info, -1);
+
+ if (sockaddr == NULL)
+ {
+ fprintf (stderr, "Failed to create unix socket with name '%s'\n", info);
+ return_value = 1;
+ return;
+ }
+
+ enumerator =
+ g_socket_connectable_proxy_enumerate (G_SOCKET_CONNECTABLE (sockaddr));
+ g_object_unref (sockaddr);
+
+ printf ("Proxies for path '%s' are:\n", info);
+ run_with_enumerator (synchronous, enumerator);
+
+ g_object_unref (enumerator);
+}
+#endif
+
+static void
+use_proxy_address (gboolean synchronous)
+{
+ GSocketAddressEnumerator *enumerator;
+ GSocketAddress *sockaddr;
+ GInetAddress *addr;
+ guint port = 0;
+ gchar *protocol;
+ gchar *dest_host;
+ guint dest_port;
+ gchar *username = NULL;
+ gchar *password = NULL;
+ gchar **split_info;
+
+ split_info = g_strsplit (info, ":", 7);
+
+ if (!split_info[0]
+ || !split_info[1]
+ || !split_info[2]
+ || !split_info[3]
+ || !split_info[4])
+ {
+ fprintf (stderr, "Bad 'ip:port:protocol:dest_host:dest_port' parameter '%s'\n", info);
+ return_value = 1;
+ return;
+ }
+
+ addr = g_inet_address_new_from_string (split_info[0]);
+ port = strtoul (split_info [1], NULL, 10);
+ protocol = g_strdup (split_info[2]);
+ dest_host = g_strdup (split_info[3]);
+ dest_port = strtoul (split_info[4], NULL, 10);
+
+ if (split_info[5])
+ {
+ username = g_strdup (split_info[5]);
+ if (split_info[6])
+ password = g_strdup (split_info[6]);
+ }
+
+ g_strfreev (split_info);
+
+ sockaddr = g_proxy_address_new (addr, port,
+ protocol, dest_host, dest_port,
+ username, password);
+
+ g_object_unref (addr);
+ g_free (protocol);
+ g_free (dest_host);
+ g_free (username);
+ g_free (password);
+
+ enumerator =
+ g_socket_connectable_proxy_enumerate (G_SOCKET_CONNECTABLE (sockaddr));
+ g_object_unref (sockaddr);
+
+ printf ("Proxies for ip and port '%s' are:\n", info);
+ run_with_enumerator (synchronous, enumerator);
+
+ g_object_unref (enumerator);
+}
+
+static void
+use_network_address (gboolean synchronous)
+{
+ GError *error = NULL;
+ GSocketAddressEnumerator *enumerator;
+ GSocketConnectable *connectable;
+
+ connectable = g_network_address_parse (info, -1, &error);
+
+ if (error)
+ {
+ print_and_free_error (error);
+ return;
+ }
+
+ enumerator = g_socket_connectable_proxy_enumerate (connectable);
+ g_object_unref (connectable);
+
+ printf ("Proxies for hostname and port '%s' are:\n", info);
+ run_with_enumerator (synchronous, enumerator);
+
+ g_object_unref (enumerator);
+}
+
+static void
+use_network_uri (gboolean synchronous)
+{
+ GError *error = NULL;
+ GSocketAddressEnumerator *enumerator;
+ GSocketConnectable *connectable;
+
+ connectable = g_network_address_parse_uri (info, 0, &error);
+
+ if (error)
+ {
+ print_and_free_error (error);
+ return;
+ }
+
+ enumerator = g_socket_connectable_proxy_enumerate (connectable);
+ g_object_unref (connectable);
+
+ printf ("Proxies for URI '%s' are:\n", info);
+ run_with_enumerator (synchronous, enumerator);
+
+ g_object_unref (enumerator);
+}
+
+static void
+use_network_service (gboolean synchronous)
+{
+ GSocketAddressEnumerator *enumerator;
+ GSocketConnectable *connectable = NULL;
+ gchar **split;
+
+ split = g_strsplit (info, "/", 3);
+
+ if (split[0] && split[1] && split[2])
+ connectable = g_network_service_new (split[0], split[1], split[2]);
+
+ g_strfreev (split);
+
+ if (connectable == NULL)
+ {
+ fprintf (stderr, "Bad 'srv/protocol/domain' parameter '%s'\n", info);
+ return_value = 1;
+ return;
+ }
+
+ enumerator = g_socket_connectable_proxy_enumerate (connectable);
+ g_object_unref (connectable);
+
+ printf ("Proxies for hostname and port '%s' are:\n", info);