mirror of
				https://github.com/yggdrasil-network/water.git
				synced 2025-11-04 03:05:10 +03:00 
			
		
		
		
	return error instead of panic()
This commit is contained in:
		
							parent
							
								
									d8e4f41ac8
								
							
						
					
					
						commit
						acc2c8967a
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -38,7 +38,7 @@ func TestBroadcast(t *testing.T) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ifce, err := NewTAP("test")
 | 
						ifce, err := NewTAP("test")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatalf("creating TAP error: %v\n", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setupIfce(t, net.IPNet{IP: self, Mask: mask}, ifce.Name())
 | 
						setupIfce(t, net.IPNet{IP: self, Mask: mask}, ifce.Name())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,10 +2,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package water
 | 
					package water
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "errors"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func newTAP(ifName string) (ifce *Interface, err error) {
 | 
					func newTAP(ifName string) (ifce *Interface, err error) {
 | 
				
			||||||
	panic("water: tap interface not implemented on this platform")
 | 
						return nil, errors.New("tap interface not implemented on this platform")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func newTUN(ifName string) (ifce *Interface, err error) {
 | 
					func newTUN(ifName string) (ifce *Interface, err error) {
 | 
				
			||||||
	panic("water: tap interface not implemented on this platform")
 | 
						return nil, errors.New("tap interface not implemented on this platform")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue