Created
November 26, 2013 12:06
-
-
Save xintron/7657317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (conn *Conn) Connect(host string) (c net.Conn, err error) { | |
log.SetFlags(23) | |
log.Printf("Connecting to host: %s\n", host) | |
// Wrapp the connection with a secure connection | |
if conn.SSL { | |
c, err = tls.Dial("tcp", host, conn.SSLConfig) | |
} else { | |
c, err = net.Dial("tcp", host) | |
} | |
if err != nil { | |
log.Panicf("Could not connect to server: %s\n", err.Error()) | |
} | |
conn.Host = host | |
conn.sock = c | |
conn.Connected = true | |
conn.postConnect() | |
return conn.sock, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment