func (cfg *NetworkServiceConfig) UnmarshalBinary(text []byte) error {
	u1, err := url.Parse(string(text))
	if err != nil {
		return err
	}
	cfg.Mechanism = u1.Scheme

	if cfg.Mechanism != "" {
		m, ok := configMechanisms[cfg.Mechanism]
		if !ok {
			return errors.Errorf("invalid mechanism specified %v. Supported: %v", cfg.Mechanism, configMechanisms)
		}
		cfg.Mechanism = m
	}
	cfg.NetworkService = u1.Hostname()
	cfg.Path = []string{}
	for _, segm := range strings.Split(u1.Path, "/") {
		if segm != "" {
			cfg.Path = append(cfg.Path, segm)
		}
	}
	for k, v := range u1.Query() {
		if cfg.Labels == nil {
			cfg.Labels = map[string]string{}
		}
		cfg.Labels[k] = v[0]
	}

	return nil
}
// UnmarshalBinary - load network service using enviornment, parsing from URL.
load network service using enviornment, parsing from URL.
// UnmarshalBinary - load network service using enviornment parsing from URL .
func (cfg *NetworkServiceConfig) UnmarshalBinary(text []byte) error {
	u1, err := url.Parse(string(text))
	if err != nil {
		return err
	}
	cfg.Mechanism = u1.Scheme
	if cfg.Mechanism != "" {
		m, ok := configMechanisms[cfg.Mechanism]
		if !ok {
			return errors.Errorf("invalid mechanism specified %v. Supported: %v", cfg.Mechanism, configMechanisms)
		}
		cfg.Mechanism = m
	}
	cfg.NetworkService = u1.Hostname()
	cfg.Path = []string{}
	for _, segm := range strings.Split(u1.Path, "/") {
		if segm != "" {
			cfg.Path = append(cfg.Path, segm)
		}
	}
	for k, v := range u1.Query() {
		if cfg.Labels == nil {
			cfg.Labels = map[string]string{}
		}
		cfg.Labels[k] = v[0]
	}
	return nil
}
func ( cfg * NetworkServiceConfig ) UnmarshalBinary ( text [ ] byte ) error { u1 , err := url . Parse ( string ( text ) ) if err != nil { return err } cfg . Mechanism = u1 . Scheme if cfg . Mechanism != " " { m , ok := configMechanisms [ cfg . Mechanism ] if ! ok { return errors . Errorf ( " " , cfg . Mechanism , configMechanisms ) } cfg . Mechanism = m } cfg . NetworkService = u1 . Hostname ( ) cfg . Path = [ ] string { } for _ , segm := range strings . Split ( u1 . Path , " " ) { if segm != " " { cfg . Path = append ( cfg . Path , segm ) } } for k , v := range u1 . Query ( ) { if cfg . Labels == nil { cfg . Labels = map [ string ] string { } } cfg . Labels [ k ] = v [ 0 ] } return nil }
load network service using enviornment, parsing from URL.
load network service using enviornment parsing from URL .