aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/model
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-16 19:46:44 -0700
committerAnton Tananaev <anton@traccar.org>2024-03-16 19:46:44 -0700
commit5b8b40faebf6996f1d2f5aef4c733dfe13d73b1b (patch)
tree74f9dd29ef50a79b6e0321e8c7fb3bf56d5e2565 /src/main/java/org/traccar/model
parentd66174fc5ee33998b5b3960336a47de3d2f00196 (diff)
downloadtrackermap-server-5b8b40faebf6996f1d2f5aef4c733dfe13d73b1b.tar.gz
trackermap-server-5b8b40faebf6996f1d2f5aef4c733dfe13d73b1b.tar.bz2
trackermap-server-5b8b40faebf6996f1d2f5aef4c733dfe13d73b1b.zip
Add local address to connection key
Diffstat (limited to 'src/main/java/org/traccar/model')
-rw-r--r--src/main/java/org/traccar/model/LogRecord.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/model/LogRecord.java b/src/main/java/org/traccar/model/LogRecord.java
index c19163af3..b04f51b32 100644
--- a/src/main/java/org/traccar/model/LogRecord.java
+++ b/src/main/java/org/traccar/model/LogRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 Anton Tananaev (anton@traccar.org)
+ * Copyright 2023 - 2024 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,24 +16,33 @@
package org.traccar.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.traccar.session.ConnectionKey;
import java.net.InetSocketAddress;
+import java.net.SocketAddress;
public class LogRecord {
- private InetSocketAddress address;
+ private final InetSocketAddress localAddress;
+ private final InetSocketAddress remoteAddress;
- public void setAddress(InetSocketAddress address) {
- this.address = address;
+ public LogRecord(SocketAddress localAddress, SocketAddress remoteAddress) {
+ this.localAddress = (InetSocketAddress) localAddress;
+ this.remoteAddress = (InetSocketAddress) remoteAddress;
}
@JsonIgnore
public InetSocketAddress getAddress() {
- return address;
+ return remoteAddress;
+ }
+
+ @JsonIgnore
+ public ConnectionKey getConnectionKey() {
+ return new ConnectionKey(localAddress, remoteAddress);
}
public String getHost() {
- return address.getHostString();
+ return remoteAddress.getHostString();
}
private String protocol;