Hi all,
I would to know if there is a way to set the value of the type of service field in the IP header of the packets sent during an http request.
In the documentation I saw that this field that can be set via the
TrafficClass , and since this class extends SocketOption , I tried to pass the traffic class as a socket option to the client connection settings.
Below is a small sample code, where I tried to set the value of the traffic type to 50:
import akka.actor.ActorSystem
import akka.http.scaladsl.settings.{ClientConnectionSettings, ConnectionPoolSettings}
import akka.http.scaladsl.{Http, HttpExt}
import akka.http.scaladsl.model._
import akka.io.Tcp.SO
object SingleRequest {
def main(args: Array[String]): Unit = {
implicit val system = ActorSystem()
val settings: ClientConnectionSettings = ClientConnectionSettings(system).withSocketOptions(Seq(SO.TrafficClass(50)))
val poolSettings: ConnectionPoolSettings =
ConnectionPoolSettings(system)
.withConnectionSettings(settings)
val http: HttpExt = Http(system)
val response = http.singleRequest(HttpRequest(uri = "http://localhost:5016"),settings = poolSettings)
}
}
However, by analyzing the packets coming to the localhost, the type of service field is always zero.
Could someone help me to set this value correctly?
Thank you very much