All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bitcoins.dlc.node.peer.Peer.scala Maven / Gradle / Ivy

There is a newer version: 1.9.9
Show newest version
package org.bitcoins.dlc.node.peer

import org.bitcoins.core.api.db.DbRowAutoInc
import org.bitcoins.tor.Socks5ProxyParams

import java.net.InetSocketAddress

case class Peer(
    socket: InetSocketAddress,
    socks5ProxyParams: Option[Socks5ProxyParams],
    id: Option[Long] = None)
    extends DbRowAutoInc[Peer] {

  override def copyWithId(id: Long): Peer = {
    this.copy(id = Some(id))
  }

  override def toString: String =
    s"Peer(${socket.getHostString}:${socket.getPort})"

}

object Peer {

  def fromSocket(
      socket: InetSocketAddress,
      socks5ProxyParams: Option[Socks5ProxyParams]): Peer = {
    Peer(socket, socks5ProxyParams = socks5ProxyParams)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy