Skip to content
Snippets Groups Projects
Commit 5339ed2d authored by Cecylia Bocovich's avatar Cecylia Bocovich
Browse files

Stop exporting internal code

parent 5927c2bd
No related branches found
No related tags found
No related merge requests found
...@@ -60,14 +60,14 @@ func (conn *overrideReadConn) Read(p []byte) (int, error) { ...@@ -60,14 +60,14 @@ func (conn *overrideReadConn) Read(p []byte) (int, error) {
return conn.Reader.Read(p) return conn.Reader.Read(p)
} }
type HTTPHandler struct { type httpHandler struct {
// pconn is the adapter layer between stream-oriented WebSocket // pconn is the adapter layer between stream-oriented WebSocket
// connections and the packet-oriented KCP layer. // connections and the packet-oriented KCP layer.
pconn *turbotunnel.QueuePacketConn pconn *turbotunnel.QueuePacketConn
ln *SnowflakeListener ln *SnowflakeListener
} }
func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (handler *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
ws, err := upgrader.Upgrade(w, r, nil) ws, err := upgrader.Upgrade(w, r, nil)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
...@@ -114,7 +114,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ...@@ -114,7 +114,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// of their stream. These clients use the WebSocket as a raw pipe, and expect // of their stream. These clients use the WebSocket as a raw pipe, and expect
// their session to begin and end when this single WebSocket does. // their session to begin and end when this single WebSocket does.
func oneshotMode(conn net.Conn, addr net.Addr, ln *SnowflakeListener) error { func oneshotMode(conn net.Conn, addr net.Addr, ln *SnowflakeListener) error {
return ln.QueueConn(&SnowflakeClientConn{Conn: conn, address: addr}) return ln.queueConn(&SnowflakeClientConn{Conn: conn, address: addr})
} }
// turbotunnelMode handles clients that sent turbotunnel.Token at the start of // turbotunnelMode handles clients that sent turbotunnel.Token at the start of
......
...@@ -35,7 +35,7 @@ func NewSnowflakeServer(getCertificate func(*tls.ClientHelloInfo) (*tls.Certific ...@@ -35,7 +35,7 @@ func NewSnowflakeServer(getCertificate func(*tls.ClientHelloInfo) (*tls.Certific
func (t *Transport) Listen(addr net.Addr) (*SnowflakeListener, error) { func (t *Transport) Listen(addr net.Addr) (*SnowflakeListener, error) {
listener := &SnowflakeListener{addr: addr, queue: make(chan net.Conn, 65534)} listener := &SnowflakeListener{addr: addr, queue: make(chan net.Conn, 65534)}
handler := HTTPHandler{ handler := httpHandler{
// pconn is shared among all connections to this server. It // pconn is shared among all connections to this server. It
// overlays packet-based client sessions on top of ephemeral // overlays packet-based client sessions on top of ephemeral
// WebSocket connections. // WebSocket connections.
...@@ -187,7 +187,7 @@ func (l *SnowflakeListener) acceptStreams(conn *kcp.UDPSession) error { ...@@ -187,7 +187,7 @@ func (l *SnowflakeListener) acceptStreams(conn *kcp.UDPSession) error {
} }
return err return err
} }
l.QueueConn(&SnowflakeClientConn{Conn: stream, address: addr}) l.queueConn(&SnowflakeClientConn{Conn: stream, address: addr})
} }
} }
...@@ -226,7 +226,7 @@ func (l *SnowflakeListener) acceptSessions(ln *kcp.Listener) error { ...@@ -226,7 +226,7 @@ func (l *SnowflakeListener) acceptSessions(ln *kcp.Listener) error {
} }
} }
func (l *SnowflakeListener) QueueConn(conn net.Conn) error { func (l *SnowflakeListener) queueConn(conn net.Conn) error {
select { select {
case <-l.closed: case <-l.closed:
return fmt.Errorf("accepted connection on closed listener") return fmt.Errorf("accepted connection on closed listener")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment