func ParseFanConfig(line string) (config FanConfig, err error) {
	if line == "" {
		return nil, nil
	}
	entries := strings.Split(line, " ")
	config = make([]FanConfigEntry, len(entries))
	for i, line := range entries {
		cidrs := strings.Split(line, "=")
		if len(cidrs) != 2 {
			return nil, fmt.Errorf("invalid FAN config entry: %v", line)
		}
		if _, config[i].Underlay, err = net.ParseCIDR(strings.TrimSpace(cidrs[0])); err != nil {
			return nil, errors.Annotatef(err, "invalid address in FAN config")
		}
		if _, config[i].Overlay, err = net.ParseCIDR(strings.TrimSpace(cidrs[1])); err != nil {
			return nil, errors.Annotatef(err, "invalid address in FAN config")
		}
		underlaySize, _ := config[i].Underlay.Mask.Size()
		overlaySize, _ := config[i].Overlay.Mask.Size()
		if underlaySize <= overlaySize {
			return nil, fmt.Errorf("invalid FAN config, underlay mask must be larger than overlay: %s", line)
		}
	}
	return config, nil
}
// ParseFanConfig parses fan configuration from model-config in the format:
// "underlay1=overlay1 underlay2=overlay2" eg. "172.16.0.0/16=253.0.0.0/8 10.0.0.0/12=254.0.0.0/7"
ParseFanConfig parses fan configuration from model-config in the format:
"underlay1=overlay1 underlay2=overlay2" eg.
// ParseFanConfig parses fan configuration from model - config in the format : // " underlay1 = overlay1 underlay2 = overlay2 " eg . " 172 . 16 . 0 . 0 / 16 = 253 . 0 . 0 . 0 / 8 10 . 0 . 0 . 0 / 12 = 254 . 0 . 0 . 0 / 7 "
func ParseFanConfig(line string) (config FanConfig, err error) {
	if line == "" {
		return nil, nil
	}
	entries := strings.Split(line, " ")
	config = make([]FanConfigEntry, len(entries))
	for i, line := range entries {
		cidrs := strings.Split(line, "=")
		if len(cidrs) != 2 {
			return nil, fmt.Errorf("invalid FAN config entry: %v", line)
		}
		if _, config[i].Underlay, err = net.ParseCIDR(strings.TrimSpace(cidrs[0])); err != nil {
			return nil, errors.Annotatef(err, "invalid address in FAN config")
		}
		if _, config[i].Overlay, err = net.ParseCIDR(strings.TrimSpace(cidrs[1])); err != nil {
			return nil, errors.Annotatef(err, "invalid address in FAN config")
		}
		underlaySize, _ := config[i].Underlay.Mask.Size()
		overlaySize, _ := config[i].Overlay.Mask.Size()
		if underlaySize <= overlaySize {
			return nil, fmt.Errorf("invalid FAN config, underlay mask must be larger than overlay: %s", line)
		}
	}
	return config, nil
}
func ParseFanConfig ( line string ) ( config FanConfig , err error ) { if line == " " { return nil , nil } entries := strings . Split ( line , " " ) config = make ( [ ] FanConfigEntry , len ( entries ) ) for i , line := range entries { cidrs := strings . Split ( line , " " ) if len ( cidrs ) != 2 { return nil , fmt . Errorf ( " " , line ) } if _ , config [ i ] . Underlay , err = net . ParseCIDR ( strings . TrimSpace ( cidrs [ 0 ] ) ) ; err != nil { return nil , errors . Annotatef ( err , " " ) } if _ , config [ i ] . Overlay , err = net . ParseCIDR ( strings . TrimSpace ( cidrs [ 1 ] ) ) ; err != nil { return nil , errors . Annotatef ( err , " " ) } underlaySize , _ := config [ i ] . Underlay . Mask . Size ( ) overlaySize , _ := config [ i ] . Overlay . Mask . Size ( ) if underlaySize <= overlaySize { return nil , fmt . Errorf ( " " , line ) } } return config , nil }
ParseFanConfig parses fan configuration from model-config in the format:
"underlay1=overlay1 underlay2=overlay2" eg.
ParseFanConfig parses fan configuration from model - config in the format : " underlay1 = overlay1 underlay2 = overlay2 " eg .