Last active
November 2, 2015 11:31
-
-
Save felixge/f5c7e66b63a0d80e6258 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
known := map[string]struct{}{} | |
for { | |
ips := []string{} | |
if data, err := ioutil.ReadFile("ips.json"); err != nil { | |
time.Sleep(3 * time.Second) | |
continue | |
} else if err := json.Unmarshal(data, &ips); err != nil { | |
time.Sleep(3 * time.Second) | |
continue | |
} | |
for _, ip := range ips { | |
if _, ok := known[ip]; !ok { | |
known[ip] = struct{}{} | |
doSomething(ip) | |
} | |
} | |
time.Sleep(3 * time.Second) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment