ing
This commit is contained in:
		
							parent
							
								
									6ac80b1a88
								
							
						
					
					
						commit
						be4832f7a9
					
				
							
								
								
									
										7
									
								
								discovery/ipv4/port.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								discovery/ipv4/port.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
package ipv4
 | 
			
		||||
 | 
			
		||||
import "git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
 | 
			
		||||
 | 
			
		||||
func ScanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}) {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								discovery/ipv6/port.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								discovery/ipv6/port.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
package ipv6
 | 
			
		||||
 | 
			
		||||
import "git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
 | 
			
		||||
 | 
			
		||||
func ScanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}) {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -1,7 +1,30 @@
 | 
			
		||||
package discovery
 | 
			
		||||
 | 
			
		||||
import "git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net"
 | 
			
		||||
 | 
			
		||||
	"git.loafle.net/overflow/overflow_discovery/api/module/discovery/model"
 | 
			
		||||
	"git.loafle.net/overflow/overflow_discovery/discovery/ipv4"
 | 
			
		||||
	"git.loafle.net/overflow/overflow_discovery/discovery/ipv6"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func scanPort(host *model.Host, dp *model.DiscoveryPort, resultChan chan interface{}, errChan chan error, doneChan chan<- struct{}) {
 | 
			
		||||
	doneChan <- struct{}{}
 | 
			
		||||
	_, ipNet, err := net.ParseCIDR(host.Zone.Network)
 | 
			
		||||
	if nil != err {
 | 
			
		||||
		errChan <- err
 | 
			
		||||
		doneChan <- struct{}{}
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	switch len(ipNet.IP) {
 | 
			
		||||
	case net.IPv4len:
 | 
			
		||||
		ipv4.ScanPort(host, dp, resultChan, errChan, doneChan)
 | 
			
		||||
	case net.IPv6len:
 | 
			
		||||
		ipv6.ScanPort(host, dp, resultChan, errChan, doneChan)
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
		errChan <- fmt.Errorf("Discovery: Not supported ip length")
 | 
			
		||||
		doneChan <- struct{}{}
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user