示例#1
0
文件: interfaces.go 项目: reth-/mole
func extraneousAddresses(cfg *conf.Config) []string {
	added := cfg.SourceAddresses()
	addedMap := make(map[string]bool)
	for _, ip := range added {
		addedMap[ip] = true
	}

	cur := currentAddresses()
	var extra []string
	for _, ip := range cur {
		if addedMap[ip] && !keepAddressRe.MatchString(ip) {
			extra = append(extra, ip)
		}
	}

	debugf("extraneous interface addresses: %v", extra)
	return extra
}
示例#2
0
文件: interfaces.go 项目: reth-/mole
func missingAddresses(cfg *conf.Config) []string {
	current := currentAddresses()
	wanted := cfg.SourceAddresses()

	curMap := make(map[string]bool)
	for _, ip := range current {
		curMap[ip] = true
	}

	var missing []string
	for _, ip := range wanted {
		if !curMap[ip] {
			missing = append(missing, ip)
		}
	}

	debugf("missing local addresses: %v", missing)
	return missing
}