mirror of https://github.com/pkg/sftp.git
packet interface now requires both un/marshal
It only required unmarshal before. Needed to add stub method to extended packet so all packets would implement the interface. This allows packet interface to be used for both incoming and outgoing packets.
This commit is contained in:
parent
ad74a75b7a
commit
c8f76e52c6
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
// all incoming packets
|
// all incoming packets
|
||||||
type packet interface {
|
type packet interface {
|
||||||
|
encoding.BinaryMarshaler
|
||||||
encoding.BinaryUnmarshaler
|
encoding.BinaryUnmarshaler
|
||||||
id() uint32
|
id() uint32
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,11 @@ func (p sshFxpReaddirPacket) getHandle() string { return p.Handle }
|
||||||
// this has a handle, but is only used for close
|
// this has a handle, but is only used for close
|
||||||
func (p sshFxpClosePacket) getHandle() string { return p.Handle }
|
func (p sshFxpClosePacket) getHandle() string { return p.Handle }
|
||||||
|
|
||||||
|
// for packet struct uniformity, so they all implement packet interface
|
||||||
|
func (s *sshFxpExtendedPacket) MarshalBinary() ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// take raw incoming packet data and build packet objects
|
// take raw incoming packet data and build packet objects
|
||||||
func makePacket(p rxPacket) (packet, error) {
|
func makePacket(p rxPacket) (packet, error) {
|
||||||
var pkt packet
|
var pkt packet
|
||||||
|
|
Loading…
Reference in New Issue