2016-01-28 18:19:23 -05:00
|
|
|
package tunnel
|
|
|
|
|
|
|
|
import (
|
2016-01-29 07:22:31 -05:00
|
|
|
"encoding/binary"
|
2016-06-17 21:07:16 -07:00
|
|
|
"github.com/hkparker/go-i2p/lib/crypto"
|
2016-01-28 18:19:23 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
type TunnelID uint32
|
|
|
|
|
|
|
|
// data sent down a tunnel
|
|
|
|
type TunnelMessage crypto.TunnelData
|
|
|
|
|
|
|
|
func (tm TunnelMessage) ID() (tid TunnelID) {
|
2016-01-29 07:22:31 -05:00
|
|
|
tid = TunnelID(binary.BigEndian.Uint32(tm[:4]))
|
|
|
|
return
|
2016-01-28 18:19:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (tm TunnelMessage) IV() crypto.TunnelIV {
|
2016-01-29 07:22:31 -05:00
|
|
|
return tm[4:20]
|
2016-01-28 18:19:23 -05:00
|
|
|
}
|