// GetIPChannelMessage returns the specified IP Message in the channel.
776403
func GetIPChannelMessage(client *TwilioIPMessagingClient, serviceSid, channelSid, sid string) (*IPMessage, error) {
	var message *IPMessage

	res, err := client.get(url.Values{}, "/Services/"+serviceSid+"/Channels/"+channelSid+"/Messages/"+sid+".json")

	if err != nil {
		return nil, err
	}

	message = new(IPMessage)
	err = json.Unmarshal(res, message)

	return message, err
}
1224183
func (n *NotifyRouter) GetChannels(i ConnectionID) keybase1.NotificationChannels {
	return n.getNotificationChannels(i)
}
1116968
func NewIPChannel(client *TwilioIPMessagingClient, serviceSid string, friendlyName string, uniqueName string, public bool, attributes string) (*IPChannel, error) {
	var channel *IPChannel

	params := url.Values{}
	params.Set("FriendlyName", friendlyName)
	params.Set("UniqueName", uniqueName)
	kind := "private"
	if public {
		kind = "public"
	}
	params.Set("Type", kind)
	params.Set("Attributes", attributes)

	res, err := client.post(params, "/Services/"+serviceSid+"/Channels.json")

	if err != nil {
		return channel, err
	}

	channel = new(IPChannel)
	err = json.Unmarshal(res, channel)

	return channel, err
}
167058
func (vm *VM) GetIPs() ([]net.IP, error) {
	server, err := getServer(vm)
	if server == nil || err != nil {
		// Probably need to call Provision first.
		return nil, err
	}

	client, err := getNetworkClient(vm)
	if client == nil || err != nil {
		// Probably need to create some network first.
		return nil, err
	}
	ips := make([]net.IP, 2)
	for _, networkID := range vm.Networks {
		network, err := networks.Get(client, networkID).Extract()
		if err != nil {
			return nil, err
		}

		addressSlice := server.Addresses[network.Name].([]interface{})
		for _, addressElement := range addressSlice {
			addressBlock := addressElement.(map[string]interface{})
			ipType := addressBlock["OS-EXT-IPS:type"].(string)
			ip := addressBlock["addr"].(string)
			if ipType == "floating" {
				ips[PublicIP] = net.ParseIP(ip)
			}
			if ipType == "fixed" {
				ips[PrivateIP] = net.ParseIP(ip)
			}
		}
	}

	return ips, nil
}
255928
func (d *Driver) GetIP() (string, error) {
	s, err := d.GetState()
	if err != nil {
		return "", errors.Wrap(err, "machine in unknown state")
	}
	if s != state.Running {
		return "", errors.New("host is not running")
	}
	ip, err := d.lookupIP()
	if err != nil {
		return "", errors.Wrap(err, "getting IP")
	}

	return ip, nil
}
1068139
func (v *TApplicationException) GetMessage() (o string) {
	if v != nil && v.Message != nil {
		return *v.Message
	}

	return
}
1201592
func (n *Networking) GetIfacesByIP(ifaceIP net.IP) ([]net.Interface, error) {
	ifaces, err := net.Interfaces()
	if err != nil {
		return nil, err
	}

	searchAddr := strings.Split(ifaceIP.String(), "/")[0]
	resultInterfaces := make([]net.Interface, 0)

	for _, iface := range ifaces {
		if iface.Flags&net.FlagLoopback != 0 {
			continue
		}

		addrs, err := iface.Addrs()
		if err != nil {
			return nil, errwrap.Wrap(fmt.Errorf("cannot get addresses for interface %v", iface.Name), err)
		}

		for _, addr := range addrs {
			currentAddr := strings.Split(addr.String(), "/")[0]
			if searchAddr == currentAddr {
				resultInterfaces = append(resultInterfaces, iface)
				break
			}
		}
	}

	if len(resultInterfaces) == 0 {
		return nil, fmt.Errorf("no interface found with IP %q", ifaceIP)
	}

	return resultInterfaces, nil
}
1221717
func (cm *rpcConnManager) BroadcastMessage(msg wire.Message) {
	cm.server.BroadcastMessage(msg)
}
1113189
func getRemoteIP() (ip string, err error) {
	client := &http.Client{
		Timeout: time.Second * 30,
	}

	req, err := http.NewRequest("GET", "http://ifconfig.me", nil)
	if err != nil {
		return
	}

	req.Header.Set("User-Agent", "curl")
	res, err := client.Do(req)
	if err != nil {
		return
	}

	defer res.Body.Close()

	data, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return
	}
	ip = string(data)

	return
}
540119
func (d *Driver) GetIP() (string, error) {
	if d.UsePrivateIP {
		return d.PrivateIP, nil
	}
	return d.PublicIP, nil
}
1219044
func GetIP(code dhcp4.OptionCode, o dhcp4.Options) IP {
	v := o.Get(code)
	if v == nil {
		return nil
	}
	var ip IP
	if err := (&ip).UnmarshalBinary(v); err != nil {
		return nil
	}
	return ip
}
784377
func GetIP(conn client.Connection, req IPRequest) (*IP, error) {
	logger := plog.WithFields(log.Fields{
		"hostid":    req.HostID,
		"ipaddress": req.IPAddress,
	})

	basepth := "/"
	if req.PoolID != "" {
		basepth = path.Join("/pools", req.PoolID)
	}

	// Get the current pool ip
	ppth := path.Join(basepth, "/ips", req.IPID())
	pdat := &PoolIP{}
	if err := conn.Get(ppth, pdat); err != nil {
		logger.WithError(err).Debug("Could not look up virtual ip on resource pool")
		// TODO: error
		return nil, err
	}
	logger.Debug("Found pool ip")

	// Get the current host ip
	hpth := path.Join(basepth, "/hosts", req.HostID, "ips", req.IPID())
	hdat := &HostIP{}
	if err := conn.Get(hpth, hdat); err != nil {
		logger.WithError(err).Debug("Could not look up virtual ip on host")
		// TODO: error
		return nil, err
	}
	logger.Debug("Found host ip")

	return &IP{
		PoolIP:    *pdat,
		HostIP:    *hdat,
		HostID:    req.HostID,
		IPAddress: req.IPAddress,
	}, nil
}
901309
func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (ret int32, err error) {
	r0, _, err := procGetMessageW.Call(uintptr(unsafe.Pointer(msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax))
	ret = int32(r0)
	return
}
224006
func (dht *IpfsDHT) sendMessage(ctx context.Context, p peer.ID, pmes *pb.Message) error {
	ctx, _ = tag.New(ctx, metrics.UpsertMessageType(pmes))

	ms, err := dht.messageSenderForPeer(ctx, p)
	if err != nil {
		stats.Record(ctx, metrics.SentMessageErrors.M(1))
		return err
	}

	if err := ms.SendMessage(ctx, pmes); err != nil {
		stats.Record(ctx, metrics.SentMessageErrors.M(1))
		return err
	}

	stats.Record(
		ctx,
		metrics.SentMessages.M(1),
		metrics.SentBytes.M(int64(pmes.Size())),
	)
	logger.Event(ctx, "dhtSentMessage", dht.self, p, pmes)
	return nil
}
1014734
func (api *Client) GetChannelInfo(channelID string) (*Channel, error) {
	return api.GetChannelInfoContext(context.Background(), channelID)
}
938065
func (i *goIpsetProvider) GetIpset(name string) Ipset {
	return &ipset.IPSet{
		Name: name,
	}
}
370678
func SendIPMessageToChannel(client *TwilioIPMessagingClient, serviceSid string, channelSid string, from string, body string) (*IPMessage, error) {
	var message *IPMessage

	params := url.Values{}
	params.Set("Body", body)
	if from != "" {
		params.Set("From", from)
	}

	res, err := client.post(params, "/Services/"+serviceSid+"/Channels/"+channelSid+"/Messages.json")

	if err != nil {
		return message, err
	}

	message = new(IPMessage)
	err = json.Unmarshal(res, message)

	return message, err
}