diff --git a/doc/soju.1.scd b/doc/soju.1.scd index 411266f..5f05429 100644 --- a/doc/soju.1.scd +++ b/doc/soju.1.scd @@ -97,6 +97,7 @@ abbreviated form, for instance *network* can be abbreviated as *net* or just _addr_ supports several connection types: - _[ircs://]host[:port]_ connects with TLS over TCP + - _irc+insecure://host[:port]_ connects with plain-text TCP Other options are: diff --git a/service.go b/service.go index 6df9fa9..fabec76 100644 --- a/service.go +++ b/service.go @@ -206,9 +206,9 @@ func handleServiceCreateNetwork(dc *downstreamConn, params []string) error { if addrParts := strings.SplitN(*addr, "://", 2); len(addrParts) == 2 { scheme := addrParts[0] switch scheme { - case "ircs": + case "ircs", "irc+insecure": default: - return fmt.Errorf("unknown scheme %q (supported schemes: ircs)", scheme) + return fmt.Errorf("unknown scheme %q (supported schemes: ircs, irc+insecure)", scheme) } } diff --git a/upstream.go b/upstream.go index 97c77fa..1020a99 100644 --- a/upstream.go +++ b/upstream.go @@ -90,6 +90,13 @@ func connectToUpstream(network *network) (*upstreamConn, error) { logger.Printf("connecting to TLS server at address %q", addr) netConn, err = tls.DialWithDialer(&dialer, "tcp", addr, nil) + case "irc+insecure": + if !strings.ContainsRune(addr, ':') { + addr = addr + ":6667" + } + + logger.Printf("connecting to plain-text server at address %q", addr) + netConn, err = dialer.Dial("tcp", addr) default: return nil, fmt.Errorf("failed to dial %q: unknown scheme: %v", addr, scheme) }