Upgrade a connection to TLS in Go

后端 未结 2 1229
不思量自难忘°
不思量自难忘° 2020-12-09 06:51

I have an open TCP connection and read from it with a for loop like so

for {
  // tx.Text is of type textproto.Conn
  // the underlying connection is stored          


        
2条回答
  •  青春惊慌失措
    2020-12-09 07:13

    Ditched swaks, built a small tool to test TLS using Go's own smtp.SendMail:

    package main
    
    import (
      "fmt"
      "net/smtp"
    )
    
    func main() {
      err := smtp.SendMail(
        "127.0.0.1:2525",
        nil,
        "src@test.local",
        []string{"dst@test.local"},
        []byte("Hello! Just testing."),
      )
      if err != nil {
        panic(err)
      }
    }
    

提交回复
热议问题