Skip to content

Commit 1ce1027

Browse files
authored
Merge pull request #7 from jsfraz/development
Development
2 parents b403108 + 23c4594 commit 1ce1027

6 files changed

Lines changed: 380 additions & 341 deletions

File tree

‎frontend/src/App.vue‎

Lines changed: 10 additions & 337 deletions
Large diffs are not rendered by default.

‎frontend/src/components/Globe.vue‎

Lines changed: 341 additions & 0 deletions
Large diffs are not rendered by default.

‎frontend/src/types/connection.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export interface Connection {
2+
id: number;
3+
ipVersion: number;
4+
ipAddress: string;
5+
latitude: number;
6+
longitude: number;
7+
countryName: string;
8+
countryCode: string;
9+
timeZone: string;
10+
zipCode: string;
11+
cityName: string;
12+
regionName: string;
13+
isProxy: boolean;
14+
continent: string;
15+
continentCode: string;
16+
user: string;
17+
password: string;
18+
timestamp: string; // ISO 8601 format
19+
}

‎frontend/src/types/ws_message.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { Connection } from './connection';
2+
3+
export interface WSMessage {
4+
type: 'attacker' | 'server_info';
5+
data: Connection;
6+
}

‎geopot/database/postgres.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ func SetupPostgres() {
5050
//
5151
// @param connection
5252
// @return error
53-
func InsertConnection(connection models.Connection) error {
53+
func InsertConnection(connection *models.Connection) error {
5454
// Ensure timestamp is in UTC
5555
connection.Timestamp = connection.Timestamp.UTC()
5656
// Use Create to add the record to the hypertable
57-
return utils.GetSingleton().Postgres.Create(&connection).Error
57+
return utils.GetSingleton().Postgres.Create(connection).Error
5858
}

‎geopot/main.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func main() {
5353
*/
5454

5555
// Insert to Postgres
56-
if err := database.InsertConnection(*connection); err != nil {
56+
if err := database.InsertConnection(connection); err != nil {
5757
log.Println(err)
5858
} else {
5959
// After successful upload, broadcast to WebSocket clients
@@ -170,7 +170,7 @@ func burstRateLimitCall(ctx context.Context, burstLimit int) {
170170
log.Println(err)
171171
} else {
172172
// Insert to Postgres
173-
if err := database.InsertConnection(*connection); err != nil {
173+
if err := database.InsertConnection(connection); err != nil {
174174
log.Println(err)
175175
} else {
176176
// After successful upload, broadcast to WebSocket clients

0 commit comments

Comments
 (0)