mirror of
https://github.com/number571/go-peer.git
synced 2026-09-12 19:50:00 +05:00
33 lines
766 B
Go
33 lines
766 B
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/number571/go-peer/pkg/network"
|
|
"github.com/number571/go-peer/pkg/network/conn"
|
|
"github.com/number571/go-peer/pkg/storage/cache/lru"
|
|
)
|
|
|
|
func newNode(serviceAddress string) network.INode {
|
|
return network.NewNode(
|
|
network.NewSettings(&network.SSettings{
|
|
FAddress: serviceAddress,
|
|
FMaxConnects: 2,
|
|
FConnSettings: connSettings(),
|
|
FWriteTimeout: time.Minute,
|
|
FReadTimeout: time.Minute,
|
|
}),
|
|
lru.NewLRUCache(1<<10),
|
|
)
|
|
}
|
|
|
|
func connSettings() conn.ISettings {
|
|
return conn.NewSettings(&conn.SSettings{
|
|
FLimitMessageSizeBytes: (1 << 10),
|
|
FWaitReadTimeout: time.Hour,
|
|
FDialTimeout: time.Minute,
|
|
FReadTimeout: time.Minute,
|
|
FWriteTimeout: time.Minute,
|
|
})
|
|
}
|