of_rpc => grpc
This commit is contained in:
parent
85efc8ea7a
commit
a72e11fa30
|
@ -2,34 +2,10 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"loafle.com/overflow/crawler_go"
|
||||
pb "loafle.com/overflow/crawler_go/grpc"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/activedirectory_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/cassandra_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/dns_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/ftp_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/ftps_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/http_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/imap_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/ldap_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/mongodb_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/mssql_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/mysql_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/netbios_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/oracle_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/pgsql_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/pop3_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/redis_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/rmi_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/smb_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/smtp_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/snmpv2c_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/snmpv3_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/ssh_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/telnet_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/wmi_protocol_crawler_go"
|
||||
"log"
|
||||
"net"
|
||||
)
|
||||
|
@ -46,31 +22,31 @@ func AddDelegate(name string, c crawler.Crawler) {
|
|||
func initCrawlers() {
|
||||
g_crawlers = make(map[string]crawler.Crawler, 0)
|
||||
|
||||
AddDelegate(pb.Crawlers_HEALTH_ACTIVEDIRECTORY.String(), activedirectory_protocol_crawler_go.NewActiveDirectoryHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_DNS.String(), dns_protocol_crawler_go.NewDNSHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_FTP.String(), ftp_protocol_crawler_go.NewFTPHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_FTPS.String(), ftps_protocol_crawler_go.NewFTPSHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_IMAP.String(), imap_protocol_crawler_go.NewIMAPHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_LDAP.String(), ldap_protocol_crawler_go.NewLDAPHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_MONGODB.String(), mongodb_protocol_crawler_go.NewMongoDBHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_MSSQL.String(), mssql_protocol_crawler_go.NewMSSqlHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_MYSQL.String(), mysql_protocol_crawler_go.NewMysqlHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_MARIADB.String(), mysql_protocol_crawler_go.NewMysqlHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_PGSQL.String(), pgsql_protocol_crawler_go.NewPGSqlHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_NETBIOS.String(), netbios_protocol_crawler_go.NewNetbiosHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_ORACLE.String(), oracle_protocol_crawler_go.NewOracleHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_POP3.String(), pop3_protocol_crawler_go.NewPOP3HeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_ACTIVEDIRECTORY.String(), activedirectory_protocol_crawler_go.NewActiveDirectoryHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_DNS.String(), dns_protocol_crawler_go.NewDNSHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_FTP.String(), ftp_protocol_crawler_go.NewFTPHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_FTPS.String(), ftps_protocol_crawler_go.NewFTPSHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_IMAP.String(), imap_protocol_crawler_go.NewIMAPHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_LDAP.String(), ldap_protocol_crawler_go.NewLDAPHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_MONGODB.String(), mongodb_protocol_crawler_go.NewMongoDBHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_MSSQL.String(), mssql_protocol_crawler_go.NewMSSqlHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_MYSQL.String(), mysql_protocol_crawler_go.NewMysqlHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_MARIADB.String(), mysql_protocol_crawler_go.NewMysqlHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_PGSQL.String(), pgsql_protocol_crawler_go.NewPGSqlHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_NETBIOS.String(), netbios_protocol_crawler_go.NewNetbiosHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_ORACLE.String(), oracle_protocol_crawler_go.NewOracleHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_POP3.String(), pop3_protocol_crawler_go.NewPOP3HeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_REDIS.String(), redis_protocol_crawler_go.NewRedisHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_RMI.String(), rmi_protocol_crawler_go.NewRMIHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_SMB.String(), smb_protocol_crawler_go.NewSMBHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_SMTP.String(), smtp_protocol_crawler_go.NewSMTPHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_SNMPV2C.String(), snmpv2c_protocol_crawler_go.NewSNMPV2CHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_SNMPV3.String(), snmpv3_protocol_crawler_go.NewSNMPV3HeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_SSH.String(), ssh_protocol_crawler_go.NewSSHHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_TELNET.String(), telnet_protocol_crawler_go.NewTelnetHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_WMI.String(), wmi_protocol_crawler_go.NewWMIHeahthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_CASSANDRA.String(), cassandra_protocol_crawler_go.NewCassandraHealthCrawler())
|
||||
AddDelegate(pb.Crawlers_HEALTH_HTTP.String(), http_protocol_crawler_go.NewHTTPHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_RMI.String(), rmi_protocol_crawler_go.NewRMIHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_SMB.String(), smb_protocol_crawler_go.NewSMBHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_SMTP.String(), smtp_protocol_crawler_go.NewSMTPHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_SNMPV2C.String(), snmpv2c_protocol_crawler_go.NewSNMPV2CHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_SNMPV3.String(), snmpv3_protocol_crawler_go.NewSNMPV3HeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_SSH.String(), ssh_protocol_crawler_go.NewSSHHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_TELNET.String(), telnet_protocol_crawler_go.NewTelnetHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_WMI.String(), wmi_protocol_crawler_go.NewWMIHeahthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_CASSANDRA.String(), cassandra_protocol_crawler_go.NewCassandraHealthCrawler())
|
||||
//AddDelegate(pb.Crawlers_HEALTH_HTTP.String(), http_protocol_crawler_go.NewHTTPHealthCrawler())
|
||||
}
|
||||
|
||||
func start(rc pb.ConfigServer, rd pb.DataServer) {
|
||||
|
|
|
@ -7,10 +7,11 @@ import (
|
|||
"google.golang.org/grpc"
|
||||
"loafle.com/overflow/crawler_go"
|
||||
pb "loafle.com/overflow/crawler_go/grpc"
|
||||
"loafle.com/overflow/redis_protocol_crawler_go"
|
||||
"log"
|
||||
"testing"
|
||||
"time"
|
||||
"loafle.com/overflow/crawler_go/health_crawler/redis_protocol_crawler_go"
|
||||
"loafle.com/overflow/crawler_go/config"
|
||||
)
|
||||
|
||||
type call func() crawler.Crawler
|
||||
|
@ -48,11 +49,19 @@ func clientCall(t *testing.T, cl pb.Crawlers) {
|
|||
func TestRedisGRPC(t *testing.T) {
|
||||
go startRPCServerTest(func() crawler.Crawler {
|
||||
rr := redis_protocol_crawler_go.NewRedisHeahthCrawler()
|
||||
m := make(map[string]interface{}, 0)
|
||||
m["ip"] = "192.168.1.104"
|
||||
m["port"] = "6379"
|
||||
m["portType"] = "tcp"
|
||||
m["ssl"] = false
|
||||
//m := make(map[string]interface{}, 0)
|
||||
//m["ip"] = "192.168.1.104"
|
||||
//m["port"] = "6379"
|
||||
//m["portType"] = "tcp"
|
||||
//m["ssl"] = false
|
||||
|
||||
m := config.Config{}
|
||||
m.Target = config.Target{}
|
||||
m.Target.Connection = config.Connection{}
|
||||
m.Target.Connection.Ip = "192.168.1.104"
|
||||
m.Target.Connection.Port = "6379"
|
||||
m.Target.Connection.PortType = "tcp"
|
||||
m.Target.Connection.SSL = false
|
||||
rr.PutConfig("test_redis_sid", m)
|
||||
return rr
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user