diff options
-rw-r--r-- | hisgle.go | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -20,8 +20,8 @@ func ethers(db *sql.DB, vlan int) { ipv4 string ) -//CREATE TABLE devices (name, mac, interface); -//CREATE TABLE addresses (mac, vlan, ipv4); + // CREATE TABLE devices (name, mac, interface); + // CREATE TABLE addresses (mac, vlan, ipv4); rows, err := db.Query("SELECT mac, ipv4 FROM addresses WHERE vlan=?", vlan) if err != nil { @@ -43,10 +43,11 @@ func hosts(db *sql.DB, vlan int) { alias string ) -//CREATE TABLE devices (name, mac, interface); -//CREATE TABLE addresses (mac, vlan, ipv4); + // CREATE TABLE devices (name, mac, interface); + // CREATE TABLE addresses (mac, vlan, ipv4); - rows, err := db.Query("SELECT a.ipv4, d.name FROM addresses AS a JOIN devices AS d ON a.mac=d.mac WHERE vlan=?", vlan) + rows, err := db.Query("SELECT a.ipv4, d.name FROM addresses AS a JOIN " + + "devices AS d ON a.mac=d.mac WHERE vlan=?", vlan) if err != nil { log.Fatal(err) } @@ -57,7 +58,7 @@ func hosts(db *sql.DB, vlan int) { } fmt.Print(ipv4, "\t", name) -// CREATE TABLE aliases (alias, target); + // CREATE TABLE aliases (alias, target); rows, err := db.Query("SELECT alias FROM aliases WHERE target=?", name) if err != nil { log.Fatal(err) @@ -79,7 +80,8 @@ func main() { ipv4 string ) - optDatabase := getopt.StringLong("database", 'd', "", "Path to SQLite3 database file with device addresses") + optDatabase := getopt.StringLong("database", 'd', "", + "Path to SQLite3 database file with device addresses") optHelp := getopt.BoolLong("help", 0, "Help") getopt.SetParameters("{ethers|hosts} list_of_networks") getopt.Parse() @@ -97,7 +99,8 @@ func main() { for _, arg := range args[1:] { vlan, _ := strconv.Atoi(arg) - rows, err := db.Query("SELECT description, ipv4 FROM networks WHERE vlan=?", vlan) + rows, err := db.Query( + "SELECT description, ipv4 FROM networks WHERE vlan=?", vlan) if err != nil { log.Fatal(err) } |