Documentation ¶
Index ¶
- Constants
- Variables
- func Int24ToInt32(b []byte) uint32
- func Int32ToInt24(b []byte, int uint32)
- type BismuthConn
- func (bmConn *BismuthConn) Close() error
- func (bmConn *BismuthConn) DoInitSteps()
- func (bmConn *BismuthConn) LocalAddr() net.Addr
- func (bmConn *BismuthConn) Read(b []byte) (n int, err error)
- func (bmConn *BismuthConn) ReadFromBuffer(b []byte) (n int, err error)
- func (bmConn *BismuthConn) ReadFromNetwork(b []byte) (n int, err error)
- func (bmConn *BismuthConn) RemoteAddr() net.Addr
- func (bmConn *BismuthConn) ResizeContentBuf() error
- func (bmConn *BismuthConn) SetDeadline(time time.Time) error
- func (bmConn *BismuthConn) SetReadDeadline(time time.Time) error
- func (bmConn *BismuthConn) SetWriteDeadline(time time.Time) error
- func (bmConn *BismuthConn) Write(b []byte) (n int, err error)
- type BismuthConnWrapped
- func (bmConn BismuthConnWrapped) Close() error
- func (bmConn BismuthConnWrapped) LocalAddr() net.Addr
- func (bmConn BismuthConnWrapped) Read(b []byte) (n int, err error)
- func (bmConn BismuthConnWrapped) RemoteAddr() net.Addr
- func (bmConn BismuthConnWrapped) SetDeadline(time time.Time) error
- func (bmConn BismuthConnWrapped) SetReadDeadline(time time.Time) error
- func (bmConn BismuthConnWrapped) SetWriteDeadline(time time.Time) error
- func (bmConn BismuthConnWrapped) Write(b []byte) (n int, err error)
Constants ¶
const ( // SendPublicKey: Sending public key back and forth SendPublicKey = iota // SwitchToSymmetricKey: Sent by the client along with the symmetric key that is going to be used SwitchToSymmetricKey // ClientSendHost: Currently unimplemented. // Client sends what host they are connecting to. ClientSendHost // GetSigningServers: Currently unimplemented. // Gets the signing servers trusting/signing the current server. GetSigningServers // GetTrustedDomains: Currently unimplemented. // Gets the domains that are supported by this certificate (should be cross-checked) GetTrustedDomains // InitiateForwarding: Starts forwarding traffic over this protocol. InitiateForwarding )
Commands
const ( BitLimit24 = 16_777_215 BitLimit16 = 65535 )
Unsigned integer limits
const ( // Default and only encryption algorithm XChaCha20Poly1305 = iota )
Encryption algorithms
Variables ¶
var ConnStandardMaxBufSize = 65535
Maximum size for a TCP packet
Functions ¶
func Int24ToInt32 ¶
Converts a 24 bit unsigned integer stored in a big-endian byte array to a 32 bit unsigned integer.
func Int32ToInt24 ¶
Converts a 32 bit unsigned integer to a 24 bit unsigned integer in a byte array using big-endian ordering.
Types ¶
type BismuthConn ¶
type BismuthConn struct { Aead cipher.AEAD PassedConn net.Conn // Maximum buffer size to be used to internally buffer packets MaxBufSize int // If true, it enables using the content buffer maximum size // instead of the TCP packet maximum size AllowNonstandardPacketSizeLimit bool // contains filtered or unexported fields }
Connection used after both the Bismuth client and server negotiate and start transmitting data.
Note that using this has the same API as the net.Conn, but it isn't conformant to the interface due to using pointers rather than copies to access the struct.
If you need the same interface, wrap this in WrappedBismuthConn. Wrapping BismuthConn is done automatically by the client and server.
func (*BismuthConn) Close ¶
func (bmConn *BismuthConn) Close() error
func (*BismuthConn) DoInitSteps ¶
func (bmConn *BismuthConn) DoInitSteps()
func (*BismuthConn) LocalAddr ¶
func (bmConn *BismuthConn) LocalAddr() net.Addr
func (*BismuthConn) Read ¶
func (bmConn *BismuthConn) Read(b []byte) (n int, err error)
Reads from the Bismuth connection, using both the buffered and network methods
func (*BismuthConn) ReadFromBuffer ¶
func (bmConn *BismuthConn) ReadFromBuffer(b []byte) (n int, err error)
Reads specifically from the buffer only. If nothing is in the buffer, nothing is returned.
func (*BismuthConn) ReadFromNetwork ¶
func (bmConn *BismuthConn) ReadFromNetwork(b []byte) (n int, err error)
Reads specifically from the network. Be careful as using only this may overflow the buffer.
func (*BismuthConn) RemoteAddr ¶
func (bmConn *BismuthConn) RemoteAddr() net.Addr
func (*BismuthConn) ResizeContentBuf ¶
func (bmConn *BismuthConn) ResizeContentBuf() error
After you update the property `bmConn.MaxBufSize`, call this function to resize the content buffer
func (*BismuthConn) SetDeadline ¶
func (bmConn *BismuthConn) SetDeadline(time time.Time) error
func (*BismuthConn) SetReadDeadline ¶
func (bmConn *BismuthConn) SetReadDeadline(time time.Time) error
func (*BismuthConn) SetWriteDeadline ¶
func (bmConn *BismuthConn) SetWriteDeadline(time time.Time) error
type BismuthConnWrapped ¶
type BismuthConnWrapped struct {
Bismuth *BismuthConn
}
Wrapped BismuthConn struct. This is conformant to net.Conn, unlike above. To get the raw Bismuth struct, just get the Bismuth property:
`bmConn.Bismuth` -> `BismuthConn`
func (BismuthConnWrapped) Close ¶
func (bmConn BismuthConnWrapped) Close() error
func (BismuthConnWrapped) LocalAddr ¶
func (bmConn BismuthConnWrapped) LocalAddr() net.Addr
func (BismuthConnWrapped) RemoteAddr ¶
func (bmConn BismuthConnWrapped) RemoteAddr() net.Addr
func (BismuthConnWrapped) SetDeadline ¶
func (bmConn BismuthConnWrapped) SetDeadline(time time.Time) error
func (BismuthConnWrapped) SetReadDeadline ¶
func (bmConn BismuthConnWrapped) SetReadDeadline(time time.Time) error
func (BismuthConnWrapped) SetWriteDeadline ¶
func (bmConn BismuthConnWrapped) SetWriteDeadline(time time.Time) error