1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package messages
import (
"bytes"
"io"
)
type PortForwardSuccess struct {
port uint32
}
func NewPortForwardSuccess(port uint32) *PortForwardSuccess {
return &PortForwardSuccess{
port: port,
}
}
func (pfs *PortForwardSuccess) Port() uint32 {
return pfs.port
}
func (pfs *PortForwardSuccess) Marshal() ([]byte, error) {
buf := new(bytes.Buffer)
if err := writeUint32(buf, pfs.port); err != nil {
return nil, err
}
return buf.Bytes(), nil
}
func (pfs *PortForwardSuccess) Unmarshal(buf io.Reader) error {
port, err := readUint32(buf)
if err != nil {
return err
}
pfs.port = port
return nil
}
|