package ipv4 import ( "fmt" "git.loafle.net/overflow/overflow_discovery/api/module/discovery/model" "github.com/google/gopacket/layers" ) func ScanService(port *model.Port, ds *model.DiscoveryService, resultChan chan interface{}, errChan chan error, stopChan chan struct{}) { switch port.PortType { case model.PortTypeTCP: if !scanServiceTCP(port, ds, resultChan, errChan, stopChan) { if dName, ok := layers.TCPPortNames[layers.TCPPort(port.PortNumber)]; ok { sName := fmt.Sprintf("Not Supported Service. Perhaps %s[%d]", dName, port.PortNumber) s := &model.Service{ ServiceName: sName, } s.Port = port resultChan <- s } } case model.PortTypeUDP: if !scanServiceUDP(port, ds, resultChan, errChan, stopChan) { if dName, ok := layers.UDPPortNames[layers.UDPPort(port.PortNumber)]; ok { sName := fmt.Sprintf("Not Supported Service. Perhaps %s[%d]", dName, port.PortNumber) s := &model.Service{ ServiceName: sName, } s.Port = port resultChan <- s } } } }