Documentation
¶
Index ¶
- Constants
- Variables
- func CloseLogFile()
- func GenerateKeyPair() (*tls.Certificate, []byte, []byte, error)
- func HashBytes(data []byte, hashLen int) []byte
- func Log(noLog []bool, v ...any)
- func MaxInt(a, b int) int
- func MinInt(a, b int) int
- func SetLogOutput(output string)
- func X509KeyPair(certPEM, keyPEM []byte) (*tls.Certificate, error)
- type ID
- type IDA
- type Server
- type Session
- func (s *Session) AcceptStream(ctx context.Context, recvBuf []byte, noLog ...bool) (*Stream, error)
- func (s *Session) Close(errCode uint64)
- func (s *Session) GetPeerIDByCertHash() []byte
- func (s *Session) OpenStream(recvBuf ...[]byte) (*Stream, error)
- func (s *Session) SendCert(cert *tls.Certificate, id ...[]byte) error
- type Stream
- func (s *Stream) Close()
- func (s *Stream) RecvData(deadline time.Time, noLog ...bool) ([]byte, int, int, error)
- func (s *Stream) RecvMessage(deadline time.Time) (*pb.NetMessage, error)
- func (s *Stream) SendData(data []byte, deadline time.Time) error
- func (s *Stream) SendMessage(message *pb.NetMessage) error
Constants ¶
View Source
const ( KSize = 24 Alpha = 3 )
View Source
const ( IDLen = KSize UserCertHashLen = 20 ServerCertHashLen = 50 )
View Source
const ( MetaDataRedundancy = 12 FileDataRedundancy = 4 )
View Source
const ( UserTLSProto = "pie-q-u-1" TrackerTLSProto = "pie-q-t-1" )
View Source
const ( SessErrNoReason = iota SessErrNotFound )
View Source
const (
MaxMessageLen = 2 * 1024 * 1024
)
Variables ¶
View Source
var ( ErrProtoEOF = errors.New("protobuf bytes EOF") ErrMsgTooLong = errors.New("message too long") ErrEmptyMsg = errors.New("empty message") ErrInvalidMsg = errors.New("invalid message") )
View Source
var (
ErrNoAddr = errors.New("no available address")
)
View Source
var (
Logger = &log.Logger{}
)
Functions ¶
func CloseLogFile ¶
func CloseLogFile()
func GenerateKeyPair ¶
func GenerateKeyPair() (*tls.Certificate, []byte, []byte, error)
func SetLogOutput ¶
func SetLogOutput(output string)
func X509KeyPair ¶
func X509KeyPair(certPEM, keyPEM []byte) (*tls.Certificate, error)
Types ¶
type Server ¶
type Server struct {
Listener quic.EarlyListener
CertHash []byte
}
func (*Server) AcceptSession ¶
type Session ¶
type Session struct {
Session quic.EarlySession
}
func (*Session) AcceptStream ¶
func (*Session) GetPeerIDByCertHash ¶
type Stream ¶
func (*Stream) RecvMessage ¶
func (*Stream) SendMessage ¶
func (s *Stream) SendMessage(message *pb.NetMessage) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.