mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-10-31 01:05:08 +03:00 
			
		
		
		
	Wake up AWDL on Darwin if awdl0 is an enabled multicast interface
This commit is contained in:
		
							parent
							
								
									58757bb955
								
							
						
					
					
						commit
						e99903bf72
					
				
					 5 changed files with 41 additions and 5 deletions
				
			
		|  | @ -2,10 +2,33 @@ | |||
| 
 | ||||
| package yggdrasil | ||||
| 
 | ||||
| /* | ||||
| #cgo CFLAGS: -x objective-c | ||||
| #cgo LDFLAGS: -framework Foundation | ||||
| #import <Foundation/Foundation.h> | ||||
| void WakeUpAWDL() { | ||||
| 	id delegateObject; // Assume this exists. | ||||
| 	NSNetServiceBrowser *serviceBrowser; | ||||
| 
 | ||||
| 	serviceBrowser = [[NSNetServiceBrowser alloc] init]; | ||||
| 	serviceBrowser.includesPeerToPeer = YES; | ||||
| 	[serviceBrowser searchForServicesOfType:@"_yggdrasil._tcp" inDomain:@""]; | ||||
| } | ||||
| */ | ||||
| import "C" | ||||
| import "syscall" | ||||
| import "golang.org/x/sys/unix" | ||||
| 
 | ||||
| func multicastReuse(network string, address string, c syscall.RawConn) error { | ||||
| func (m *multicast) multicastWake() { | ||||
| 	for _, intf := range m.interfaces() { | ||||
| 		if intf.Name == "awdl0" { | ||||
| 			m.core.log.Infoln("Multicast discovery is waking up AWDL") | ||||
| 			C.WakeUpAWDL() | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func (m *multicast) multicastReuse(network string, address string, c syscall.RawConn) error { | ||||
| 	var control error | ||||
| 	var reuseport error | ||||
| 	var recvanyif error | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Neil Alexander
						Neil Alexander