Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
382 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Simple WebSocket implements over TCP/TLS. | ||
// | ||
// References: | ||
// https://tools.ietf.org/html/rfc6455 | ||
// http://www.hcn.zaq.ne.jp/___/WEB/RFC6455-ja.html | ||
package aun | ||
|
||
// Connection state constants | ||
const ( | ||
INITIALIZE = iota | ||
OPENING | ||
CONNECTED | ||
CLOSING | ||
CLOSED | ||
) | ||
|
||
// Sec-WebSocket-Accept key calculate seed | ||
const ACCEPTKEY = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
package aun | ||
|
||
// Simple message struct. | ||
type Message struct { | ||
MessageReadable | ||
Readable | ||
Data string | ||
} | ||
|
||
// Create []byte wrapped pointer | ||
func NewMessage(data []byte) *Message { | ||
return &Message{ | ||
Data: string(data), | ||
} | ||
} | ||
|
||
// Readable interface implement | ||
func (m *Message) getData() []byte { | ||
return []byte(m.Data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package aun | ||
|
||
// Readable Interface | ||
|
||
// This package's channel messaging type must be implement this interface. | ||
// Messages will get the bytes for messaage through the "getData" method. | ||
type Readable interface { | ||
getData() []byte | ||
} |
Oops, something went wrong.