Suharsh Sivakumar | 7e93ce5 | 2015-05-07 17:46:13 -0700 | [diff] [blame^] | 1 | // Copyright 2015 The Vanadium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // +build !nacl |
| 6 | |
| 7 | package websocket |
| 8 | |
| 9 | import ( |
| 10 | "net" |
| 11 | ) |
| 12 | |
| 13 | // Resolve performs a DNS resolution on the provided protocol and address. |
| 14 | func Resolve(protocol, address string) (string, string, error) { |
| 15 | tcp := mapWebSocketToTCP[protocol] |
| 16 | tcpAddr, err := net.ResolveTCPAddr(tcp, address) |
| 17 | if err != nil { |
| 18 | return "", "", err |
| 19 | } |
| 20 | return "ws", tcpAddr.String(), nil |
| 21 | } |