[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/main] Change package name and add a package comment



commit 04ba50a531f118b710edd6722e8e07fc9f3a9b3c
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date:   Fri Oct 1 13:44:31 2021 -0400

    Change package name and add a package comment
---
 server/lib/http.go             |  2 +-
 server/lib/server_test.go      |  2 +-
 server/lib/snowflake.go        | 38 +++++++++++++++++++++++++++++++++++++-
 server/lib/turbotunnel.go      |  2 +-
 server/lib/turbotunnel_test.go |  2 +-
 5 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/server/lib/http.go b/server/lib/http.go
index 8184c06..55849c5 100644
--- a/server/lib/http.go
+++ b/server/lib/http.go
@@ -1,4 +1,4 @@
-package lib
+package snowflake_server
 
 import (
 	"bufio"
diff --git a/server/lib/server_test.go b/server/lib/server_test.go
index 65d31d1..8e0deb4 100644
--- a/server/lib/server_test.go
+++ b/server/lib/server_test.go
@@ -1,4 +1,4 @@
-package lib
+package snowflake_server
 
 import (
 	"net"
diff --git a/server/lib/snowflake.go b/server/lib/snowflake.go
index 8f81353..93d3955 100644
--- a/server/lib/snowflake.go
+++ b/server/lib/snowflake.go
@@ -1,4 +1,40 @@
-package lib
+/*
+Package snowflake_server implements the functionality necessary to accept Snowflake
+connections from Snowflake clients.
+
+Included in the package is a Transport type that implements the Pluggable Transports v2.1 Go API
+specification. To start a TLS Snowflake server using the golang.org/x/crypto/acme/autocert
+library, configure a certificate manager for the server's domain name and then create a new
+Transport as follows:
+
+	// The snowflake server runs a websocket server. To run this securely, you will
+	// need a valid certificate.
+	certManager := &autocert.Manager{
+		Prompt:     autocert.AcceptTOS,
+		HostPolicy: autocert.HostWhitelist("snowflake.yourdomain.com"),
+		Email:      "you@xxxxxxxxxxxxxx",
+	}
+
+	transport := snowflake_server.NewSnowflakeServer(certManager.GetCertificate)
+
+
+The Listen function starts a new listener, and Accept will return incoming Snowflake connections:
+
+	ln, err := transport.Listen(addr)
+	if err != nil {
+		// handle error
+	}
+	for {
+		conn, err := ln.Accept()
+		if err != nil {
+			// handle error
+		}
+		// handle conn
+	}
+
+
+*/
+package snowflake_server
 
 import (
 	"crypto/tls"
diff --git a/server/lib/turbotunnel.go b/server/lib/turbotunnel.go
index 741992d..1e9bb58 100644
--- a/server/lib/turbotunnel.go
+++ b/server/lib/turbotunnel.go
@@ -1,4 +1,4 @@
-package lib
+package snowflake_server
 
 import (
 	"net"
diff --git a/server/lib/turbotunnel_test.go b/server/lib/turbotunnel_test.go
index 85404af..ac79c05 100644
--- a/server/lib/turbotunnel_test.go
+++ b/server/lib/turbotunnel_test.go
@@ -1,4 +1,4 @@
-package lib
+package snowflake_server
 
 import (
 	"encoding/binary"

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits