Exemple #1
0
func main() {
	if len(os.Args) < 2 {
		fmt.Fprintf(os.Stderr, "Usage: %s <address>\n", os.Args[0])
		os.Exit(1)
	}
	l, err := net.Listen("tcp", os.Args[1])
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error: %v\n", err)
		os.Exit(1)
	}
	defer l.Close()
	for {
		c, err := l.Accept()
		if err != nil {
			fmt.Fprintf(os.Stderr, "Error: %v\n", err)
			os.Exit(1)
		}
		conn := sssl.Server(c, dh.Private())
		go func() {
			defer conn.Close()
			io.Copy(conn, conn)
		}()
	}
}
Exemple #2
0
func main() {
	conn := sssl.Server(stdio.NewStdioConn(), dh.Private())
	io.Copy(conn, conn)
}