package wire
import (
"github.com/quic-go/quic-go/internal/protocol"
"github.com/quic-go/quic-go/internal/qerr"
"github.com/quic-go/quic-go/quicvarint"
)
type StopSendingFrame struct {
StreamID protocol .StreamID
ErrorCode qerr .StreamErrorCode
}
func parseStopSendingFrame(b []byte , _ protocol .Version ) (*StopSendingFrame , int , error ) {
startLen := len (b )
streamID , l , err := quicvarint .Parse (b )
if err != nil {
return nil , 0 , replaceUnexpectedEOF (err )
}
b = b [l :]
errorCode , l , err := quicvarint .Parse (b )
if err != nil {
return nil , 0 , replaceUnexpectedEOF (err )
}
b = b [l :]
return &StopSendingFrame {
StreamID : protocol .StreamID (streamID ),
ErrorCode : qerr .StreamErrorCode (errorCode ),
}, startLen - len (b ), nil
}
func (f *StopSendingFrame ) Length (_ protocol .Version ) protocol .ByteCount {
return 1 + protocol .ByteCount (quicvarint .Len (uint64 (f .StreamID ))+quicvarint .Len (uint64 (f .ErrorCode )))
}
func (f *StopSendingFrame ) Append (b []byte , _ protocol .Version ) ([]byte , error ) {
b = append (b , byte (FrameTypeStopSending ))
b = quicvarint .Append (b , uint64 (f .StreamID ))
b = quicvarint .Append (b , uint64 (f .ErrorCode ))
return b , nil
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .