Hack in SSL support
This commit is contained in:
parent
67c1c92623
commit
b62f72a746
35
irc.go
35
irc.go
@ -10,6 +10,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"crypto/tls"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -166,15 +167,7 @@ func (i *IRCConnection) Loop() {
|
|||||||
<-i.syncwriter
|
<-i.syncwriter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *IRCConnection) Connect(server string) error {
|
func (i *IRCConnection) postConnect() error {
|
||||||
i.server = server
|
|
||||||
fmt.Printf("Connecting to %s\n", i.server)
|
|
||||||
var err error
|
|
||||||
i.socket, err = net.Dial("tcp", i.server)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
fmt.Printf("Connected to %s (%s)\n", i.server, i.socket.RemoteAddr())
|
|
||||||
i.pread = make(chan string, 100)
|
i.pread = make(chan string, 100)
|
||||||
i.pwrite = make(chan string, 100)
|
i.pwrite = make(chan string, 100)
|
||||||
i.Error = make(chan error, 10)
|
i.Error = make(chan error, 10)
|
||||||
@ -191,6 +184,30 @@ func (i *IRCConnection) Connect(server string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *IRCConnection) Connect(server string) error {
|
||||||
|
i.server = server
|
||||||
|
fmt.Printf("Connecting to %s\n", i.server)
|
||||||
|
var err error
|
||||||
|
i.socket, err = net.Dial("tcp", i.server)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Printf("Connected to %s (%s)\n", i.server, i.socket.RemoteAddr())
|
||||||
|
return i.postConnect()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *IRCConnection) ConnectSSL(server string) error {
|
||||||
|
i.server = server
|
||||||
|
fmt.Printf("Connecting to %s over SSL\n", i.server)
|
||||||
|
var err error
|
||||||
|
i.socket, err = tls.Dial("tcp", i.server, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Printf("Connected to %s (%s) over SSL\n", i.server, i.socket.RemoteAddr())
|
||||||
|
return i.postConnect()
|
||||||
|
}
|
||||||
|
|
||||||
func IRC(nick, user string) *IRCConnection {
|
func IRC(nick, user string) *IRCConnection {
|
||||||
irc := new(IRCConnection)
|
irc := new(IRCConnection)
|
||||||
irc.registered = false
|
irc.registered = false
|
||||||
|
Loading…
Reference in New Issue
Block a user