code: func buildJoinOptions(networkSettings *internalnetwork.Settings, n interface {
  	Name() string
  }) ([]libnetwork.EndpointOption, error) {
  	var joinOptions []libnetwork.EndpointOption
  	if epConfig, ok := networkSettings.Networks[n.Name()]; ok {
  		for _, str := range epConfig.Links {
  			name, alias, err := opts.ParseLink(str)
  			if err != nil {
  				return nil, err
  			}
  			joinOptions = append(joinOptions, libnetwork.CreateOptionAlias(name, alias))
  		}
  		for k, v := range epConfig.DriverOpts {
  			joinOptions = append(joinOptions, libnetwork.EndpointOptionGeneric(options.Generic{k: v}))
  		}
  	}
  
  	return joinOptions, nil
  }
docs: // buildJoinOptions builds endpoint Join options from a given network.