func (rd *IPSECKEY) SetGateway(g interface{}) (t GatewayType, err error) {
	switch x := g.(type) {
	default:
		err = fmt.Errorf("(*IPSECKEY).SetGateway(%T): unsupported", g)
	case nil:
		rd.GatewayType, rd.Gateway = GatewayNone, nil
	case net.IP:
		if ip := x.To4(); ip != nil {
			rd.GatewayType, rd.Gateway = GatewayIPV4, ip
			break
		}

		if ip := x.To16(); ip != nil {
			rd.GatewayType, rd.Gateway = GatewayIPV6, ip
			break
		}

		err = fmt.Errorf("(*IPSECKEY).SetGateway(%#v): unsupported", g)
	case string:
		rd.GatewayType, rd.Gateway = GatewayDomain, dns.DomainName(x)
	case dns.DomainName:
		rd.GatewayType, rd.Gateway = GatewayDomain, string(x)
	}

	t = rd.GatewayType
	return
}
// SetGeteway will safely set d.Gateway and d.GatewayType or return an error
// otherwise if g type is not (nil or net.IP or a string).
SetGeteway will safely set d.Gateway and d.GatewayType or return an error
otherwise if g type is not (nil or net.IP or a string).
// SetGeteway will safely set d . Gateway and d . GatewayType or return an error // otherwise if g type is not ( nil or net . IP or a string ) .
func (rd *IPSECKEY) SetGateway(g interface{}) (t GatewayType, err error) {
	switch x := g.(type) {
	default:
		err = fmt.Errorf("(*IPSECKEY).SetGateway(%T): unsupported", g)
	case nil:
		rd.GatewayType, rd.Gateway = GatewayNone, nil
	case net.IP:
		if ip := x.To4(); ip != nil {
			rd.GatewayType, rd.Gateway = GatewayIPV4, ip
			break
		}
		if ip := x.To16(); ip != nil {
			rd.GatewayType, rd.Gateway = GatewayIPV6, ip
			break
		}
		err = fmt.Errorf("(*IPSECKEY).SetGateway(%#v): unsupported", g)
	case string:
		rd.GatewayType, rd.Gateway = GatewayDomain, dns.DomainName(x)
	case dns.DomainName:
		rd.GatewayType, rd.Gateway = GatewayDomain, string(x)
	}
	t = rd.GatewayType
	return
}
func ( rd * IPSECKEY ) SetGateway ( g interface { } ) ( t GatewayType , err error ) { switch x := g . ( type ) { default : err = fmt . Errorf ( " " , g ) case nil : rd . GatewayType , rd . Gateway = GatewayNone , nil case net . IP : if ip := x . To4 ( ) ; ip != nil { rd . GatewayType , rd . Gateway = GatewayIPV4 , ip break } if ip := x . To16 ( ) ; ip != nil { rd . GatewayType , rd . Gateway = GatewayIPV6 , ip break } err = fmt . Errorf ( " " , g ) case string : rd . GatewayType , rd . Gateway = GatewayDomain , dns . DomainName ( x ) case dns . DomainName : rd . GatewayType , rd . Gateway = GatewayDomain , string ( x ) } t = rd . GatewayType return }
SetGeteway will safely set d.Gateway and d.GatewayType or return an error
otherwise if g type is not (nil or net.IP or a string).
SetGeteway will safely set d . Gateway and d . GatewayType or return an error otherwise if g type is not ( nil or net . IP or a string ) .