mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-05 14:13:30 -04:00
29 lines
425 B
Go
29 lines
425 B
Go
![]() |
package common
|
||
|
|
||
|
import (
|
||
|
"encoding/binary"
|
||
|
"github.com/bounce-chat/go-i2p/lib/tunnel"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
LEASE_SIZE = 44
|
||
|
)
|
||
|
|
||
|
type Lease [LEASE_SIZE]byte
|
||
|
|
||
|
func (lease Lease) TunnelGateway() (h IdentHash) {
|
||
|
copy(lease[:32], h[:])
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (lease Lease) TunnelID() tunnel.TunnelID {
|
||
|
return tunnel.TunnelID(
|
||
|
binary.BigEndian.Uint32(lease[32:36]),
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func (lease Lease) Date() (d Date) {
|
||
|
copy(lease[36:], d[:])
|
||
|
return
|
||
|
}
|