From 620fd31b106da05d80674d76bbbd1e079ef0f386 Mon Sep 17 00:00:00 2001 From: Arsen Musayelyan Date: Fri, 4 Dec 2020 02:12:32 -0800 Subject: [PATCH] Add --skip-mdns to allow full bypassing of zeroconf. This allows operation within iOS --- .gitignore | 2 +- main.go | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index a028b7f..da3187c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .idea/ opensend -opensend-arm \ No newline at end of file +opensend-* diff --git a/main.go b/main.go index ea13e3d..9adbd7c 100644 --- a/main.go +++ b/main.go @@ -53,6 +53,8 @@ func main() { actionType := flag.String("t", "","Type of data being sent") // Create -d flag for data actionData := flag.String("d", "", "Data to send") + // Create --skip-mdns to skip service registration + skipMdns := flag.Bool("skip-mdns", false, "Skip zeroconf service registration (use if mdns fails)") // Create -s flag for sending sendFlag := flag.Bool("s", false, "Send data") // Create -r flag for receiving @@ -136,10 +138,13 @@ func main() { SendFiles(opensendDir) // If -r given } else if *recvFlag { - // Register {hostname}._opensend._tcp.local. mDNS service and pass shutdown function - zeroconfShutdown := RegisterService() - // Shutdown zeroconf server at the end of main() - defer zeroconfShutdown() + // If --skip-mdns is not given + if !*skipMdns { + // Register {hostname}._opensend._tcp.local. mDNS service and pass shutdown function + zeroconfShutdown := RegisterService() + // Shutdown zeroconf server at the end of main() + defer zeroconfShutdown() + } // Notify user opensend is waiting for key exchange log.Info().Msg("Waiting for sender key exchange") // Generate keypair