# Peer Management
One of the first things you'll need to do when building your own Lightning node is connect to a peer. In LDK this is handled by the PeerManager
(opens new window).
The PeerManager
has two dependencies:
- A
ChannelManager
(opens new window) that enables it to notify peers when it wants to do things such as open channels. - A
P2PGossipSync
(opens new window) that understands when peers you are connected to send you gossip messages, enables you to forward messages, announce channel opens and more.
Since LDK knows nothing about your networking stack, you'll need to implement your own networking logic in order to connect to peers on the network. Provide LDK with raw TCP/IP socket data and the library will handle the rest for you.
LDK also handles a number of background tasks that need to happen periodically via BackgroundProcessor
(opens new window)
Default Implementation
If you are developing in a Rust Tokio (opens new window) environment, LDK ships with a socket handling crate (opens new window) that let's you easily create new connections with peers.