Add --skip-mdns to allow full bypassing of zeroconf. This allows operation within iOS

This commit is contained in:
Elara 2020-12-04 02:12:32 -08:00
parent c909759d33
commit 620fd31b10
2 changed files with 10 additions and 5 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
.idea/ .idea/
opensend opensend
opensend-arm opensend-*

View File

@ -53,6 +53,8 @@ func main() {
actionType := flag.String("t", "","Type of data being sent") actionType := flag.String("t", "","Type of data being sent")
// Create -d flag for data // Create -d flag for data
actionData := flag.String("d", "", "Data to send") 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 // Create -s flag for sending
sendFlag := flag.Bool("s", false, "Send data") sendFlag := flag.Bool("s", false, "Send data")
// Create -r flag for receiving // Create -r flag for receiving
@ -136,10 +138,13 @@ func main() {
SendFiles(opensendDir) SendFiles(opensendDir)
// If -r given // If -r given
} else if *recvFlag { } else if *recvFlag {
// If --skip-mdns is not given
if !*skipMdns {
// Register {hostname}._opensend._tcp.local. mDNS service and pass shutdown function // Register {hostname}._opensend._tcp.local. mDNS service and pass shutdown function
zeroconfShutdown := RegisterService() zeroconfShutdown := RegisterService()
// Shutdown zeroconf server at the end of main() // Shutdown zeroconf server at the end of main()
defer zeroconfShutdown() defer zeroconfShutdown()
}
// Notify user opensend is waiting for key exchange // Notify user opensend is waiting for key exchange
log.Info().Msg("Waiting for sender key exchange") log.Info().Msg("Waiting for sender key exchange")
// Generate keypair // Generate keypair