diff --git a/.env.template b/.env.template index 22016b6..3cae7b0 100644 --- a/.env.template +++ b/.env.template @@ -3,5 +3,8 @@ INFLUXDB_PASSWORD= INFLUXDB_TOKEN= INFLUXDB_ORG= INFLUXDB_BUCKET= +MQTT_URL= MQTT_USERNAME= MQTT_PASSWORD= +REST_USERNAME= +REST_PASSWORD= \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8b6d828 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +variables: + DOCKER_IMAGE: registry.forge.hefr.ch/team-raclette/project-softweng/gateway:latest + +default: + image: $DOCKER_IMAGE + +stages: + - build-docker + +# This job runs only when Dockerfile changes +docker-build: + image: docker:latest + stage: build-docker + services: + - docker:dind + script: + - docker build -t $DOCKER_IMAGE -f gateway/Dockerfile . + - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY + - docker push $DOCKER_IMAGE + rules: + - if: $GITLAB_CI == 'false' # Only run in GitLab CI + when: never + - changes: + - gateway/Dockerfile + - gateway/src/* diff --git a/docker-compose.yml b/docker-compose.yml index 05ceec9..5861150 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,32 @@ volumes: rabbitmq_data: services: + gateway: + image: registry.forge.hefr.ch/team-raclette/project-softweng/gateway:latest + container_name: gateway + restart: unless-stopped + environment: + - INFLUXDB_TOKEN=$INFLUXDB_TOKEN + - INFLUXDB_ORG=$INFLUXDB_ORG + - INFLUXDB_BUCKET=$INFLUXDB_BUCKET + - MQTT_USERNAME=$MQTT_USERNAME + - MQTT_PASSWORD=$MQTT_PASSWORD + - REST_USERNAME=$REST_USERNAME + - REST_PASSWORD=$REST_PASSWORD + + - INFLUXDB_URL=http://influx.mse.kb28.ch + - CLIENT_ID=Gateway-SoftwEng + - MQTT_URL=http://mqtt.mse.kb28.ch + - MEASUREMENT_NAME=THC + labels: + - "traefik.enable=true" + - "traefik.http.routers.Gateway-http.entrypoints=http" + - "traefik.http.routers.Gateway-http.rule=Host(`rest.mse.kb28.ch`)" + - "traefik.http.middlewares.Gateway-redirect.redirectscheme.scheme=https" + - "traefik.http.routers.Gateway-https.entrypoints=https" + - "traefik.http.routers.Gateway-https.rule=Host(`rest.mse.kb28.ch`)" + - "traefik.http.routers.Gateway-https.tls.certResolver=letsencrypt" + - "traefik.http.services.Gateway-https.loadbalancer.server.port=8080" influxdb: image: influxdb:2 container_name: influxdb @@ -23,6 +49,15 @@ services: - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=$INFLUXDB_TOKEN - DOCKER_INFLUXDB_INIT_ORG=$INFLUXDB_ORG - DOCKER_INFLUXDB_INIT_BUCKET=$INFLUXDB_BUCKET + labels: + - "traefik.enable=true" + - "traefik.http.routers.influx-http.entrypoints=http" + - "traefik.http.routers.influx-http.rule=Host(`influx.mse.kb28.ch`)" + - "traefik.http.middlewares.influx-redirect.redirectscheme.scheme=https" + - "traefik.http.routers.influx-https.entrypoints=https" + - "traefik.http.routers.influx-https.rule=Host(`influx.mse.kb28.ch`)" + - "traefik.http.routers.influx-https.tls.certResolver=letsencrypt" + - "traefik.http.services.influx-https.loadbalancer.server.port=8086" rabbitmq: image: rabbitmq:3-management-alpine container_name: rabbitmq @@ -39,3 +74,12 @@ services: - RABBITMQ_DEFAULT_PASS=$MQTT_PASSWORD command: sh -c "rabbitmq-plugins enable rabbitmq_mqtt && rabbitmq-server" + labels: + - "traefik.enable=true" + - "traefik.http.routers.mqtt-http.entrypoints=http" + - "traefik.http.routers.mqtt-http.rule=Host(`mqtt.mse.kb28.ch`)" + - "traefik.http.middlewares.mqtt-redirect.redirectscheme.scheme=https" + - "traefik.http.routers.mqtt-https.entrypoints=https" + - "traefik.http.routers.mqtt-https.rule=Host(`mqtt.mse.kb28.ch`)" + - "traefik.http.routers.mqtt-https.tls.certResolver=letsencrypt" + - "traefik.http.services.mqtt-https.loadbalancer.server.port=1883" diff --git a/gateway/Dockerfile b/gateway/Dockerfile new file mode 100644 index 0000000..778544f --- /dev/null +++ b/gateway/Dockerfile @@ -0,0 +1,27 @@ +FROM golang:1.23-alpine AS builder + +WORKDIR /app + +COPY ./src/go.mod ./src/go.sum ./ +RUN go mod tidy + +COPY ./src . +#RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o /gateway . +RUN go build -o /gateway . + + +FROM alpine:latest AS certs +RUN apk --no-cache add ca-certificates + +FROM scratch AS final +LABEL org.opencontainers.image.authors="remi.heredero@hevs.ch" \ + org.opencontainers.image.title="Gateway for SoftwEng course" \ + org.opencontainers.image.description="This container is an application for the lab on SoftwEng course" \ + org.opencontainers.image.source="https://gitlab.forge.hefr.ch/team-raclette/project-softweng/-/tree/main/gateway?ref_type=heads" + +COPY --from=builder /gateway /gateway +COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ + +EXPOSE 8080 + +ENTRYPOINT ["/gateway"] \ No newline at end of file diff --git a/gateway/src/Connection.go b/gateway/src/Connection.go new file mode 100644 index 0000000..66ab1d4 --- /dev/null +++ b/gateway/src/Connection.go @@ -0,0 +1,239 @@ +package main + +import ( + _ "crypto/md5" + _ "gateway-softweng/docs" + paho "github.com/eclipse/paho.mqtt.golang" + "github.com/gin-gonic/gin" + influxdb2 "github.com/influxdata/influxdb-client-go/v2" + "github.com/influxdata/influxdb-client-go/v2/api" + "github.com/labstack/gommon/log" + swaggerFiles "github.com/swaggo/files" + ginSwagger "github.com/swaggo/gin-swagger" + "net/http" + "os" +) + +type Gateway struct { + username string + password string + mqtt paho.Client + rest *gin.Engine + restGroup *gin.RouterGroup + accounts gin.Accounts + influx influxdb2.Client + influxApi api.WriteAPIBlocking +} + +// @Summary Ping test endpoint +// @Description get ping response +// @Tags ping +// @Accept json +// @Produce json +// @Success 200 {string} string "pong" +// @Router /ping [get] +func pingHandler(c *gin.Context) { + c.String(http.StatusOK, "pong") +} + +// getUsers initializes user account. +// +// It performs the following actions: +// - Creates user accounts with usernames and password provided by environnement variable +// - Stores the credentials for basic authentication. +func (gh *Gateway) getUser() { + // Create username + ok := false + gh.username, ok = os.LookupEnv("REST_USERNAME") + if !ok { + log.Fatal("REST_USERNAME not set") + } + + gh.password, ok = os.LookupEnv("REST_PASSWORD") + if !ok { + log.Fatal("REST_PASSWORD not set") + } + + gh.accounts = gin.Accounts{} + gh.accounts[gh.username] = gh.password + +} + +// createRestGateway sets up the REST API using the Gin framework. +// It defines the following routes: +// - A public ping test endpoint for health checks. +// - A Swagger documentation endpoint for API documentation. +// - A secured group of endpoints for commands and data requests, protected by basic authentication. +// +// Behavior: +// - The `/ping` endpoint responds with "pong" to test server availability. +// - The `/swagger/*any` endpoint serves the Swagger UI for API documentation. +// - The `/raclette` group includes: +// - A POST route for publishing commands to MQTT. +// - A GET route for requesting data from InfluxDB. +// +// Security: +// - The `/raclette` group requires basic authentication using credentials generated for each user. +func (gh *Gateway) createRestGateway() { + // Create a new Gin router + gh.rest = gin.Default() + + gh.rest.GET("/ping", pingHandler) + + // Swagger documentation route + gh.rest.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) + + // Create a new router group with basic authentication for /raclette + gh.restGroup = gh.rest.Group("/raclette", gin.BasicAuth(gh.accounts)) + + // Define the route for the publish command + gh.restGroup.POST("", func(c *gin.Context) { + ret := gh.publishCommand(c) + if ret == nil { + c.JSON(http.StatusOK, gin.H{"status": "ok"}) + } else { + c.JSON(http.StatusInternalServerError, gin.H{"error": ret.Error()}) + } + }) + + // Define the route for the publish command (GET) + gh.restGroup.GET("", func(c *gin.Context) { + ret := gh.requestInflux(c) + if ret != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": ret.Error()}) + } + }) +} + +// createMQTTGateway initializes the MQTT client and sets up subscriptions. +// +// It subscribes to the following topics: +// - "+/+/+/update": For device state updates. +// +// The OnConnect callback ensures that subscriptions are re-established after reconnecting. +// +// Returns: +// - error: An error if the MQTT client fails to connect or subscribe to topics. +func (gh *Gateway) createMQTTGateway() error { + + // Get env variables and set default values if not set + MQTT_URL, ok := os.LookupEnv("MQTT_URL") + if !ok { + log.Error("MQTT_URL not set, using default value: tcp://mqtt.mse.kb28.ch:1883") + MQTT_URL = "tcp://mqtt.mse.kb28.ch:1883" + } + + CLIENT_ID, ok := os.LookupEnv("CLIENT_ID") + if !ok { + log.Error("CLIENT_ID not set, using default value: Gateway-SoftwEng") + CLIENT_ID = "Gateway-SoftwEng" + } + + // Get env variables for MQTT credentials, panic if not set + MQTT_USERNAME, ok := os.LookupEnv("MQTT_USERNAME") + if !ok { + log.Fatal("MQTT_USERNAME not set") + } + MQTT_PASSWORD, ok := os.LookupEnv("MQTT_PASSWORD") + if !ok { + log.Fatal("MQTT_PASSWORD not set") + } + + // Create MQTT client + option := paho.NewClientOptions() + option.AddBroker(MQTT_URL) + option.SetClientID(CLIENT_ID) + option.SetUsername(MQTT_USERNAME) + option.SetPassword(MQTT_PASSWORD) + option.SetAutoReconnect(true) + option.OnConnect = func(client paho.Client) { + + // Subscribe to update + token := gh.mqtt.Subscribe("+/+/+/update", 0, gh.processUpdate) + if token.Wait() && token.Error() != nil { + log.Error(token.Error()) + client.Disconnect(1000) // Disconnect from the broker after 1000ms + } + + } + gh.mqtt = paho.NewClient(option) + token := gh.mqtt.Connect() + if token.Wait() && token.Error() != nil { + return token.Error() + } + return nil +} + +// createInfluxGateway initializes the InfluxDB client. +func (gh *Gateway) createInfluxGateway() { + + // Get env variables and set default values if not set + INFLUXDB_ORG, ok := os.LookupEnv("INFLUXDB_ORG") + if !ok { + log.Error("INFLUXDB_ORG not set, using default value: raclette") + INFLUXDB_ORG = "raclette" + } + + INFLUXDB_BUCKET, ok := os.LookupEnv("INFLUXDB_BUCKET") + if !ok { + log.Error("INFLUXDB_BUCKET not set, using default value: raclette") + INFLUXDB_BUCKET = "raclette" + } + + // Get env variables and set default values if not set + INFLUXDB_URL, ok := os.LookupEnv("INFLUXDB_URL") + if !ok { + log.Error("INFLUXDB_URL not set, using default value: http://influx.mse.kb28.ch") + INFLUXDB_URL = "http://influx.mse.kb28.ch" + } + + // Get env variables for InfluxDB credentials, panic if not set + INFLUXDB_TOKEN, ok := os.LookupEnv("INFLUXDB_TOKEN") + if !ok { + log.Fatal("INFLUXDB_TOKEN not set") + } + + // Initialize the InfluxDB client + gh.influx = influxdb2.NewClient(INFLUXDB_URL, INFLUXDB_TOKEN) + gh.influxApi = gh.influx.WriteAPIBlocking(INFLUXDB_ORG, INFLUXDB_BUCKET) + gh.influxApi.EnableBatching() +} + +// NewGateway initializes the Gateway instance by setting up the necessary components. +// +// It performs the following actions: +// - Initializes the InfluxDB client using the provided token. +// - Creates user account with unique credentials and InfluxDB write APIs. +// - Sets up the REST API server with routes for health checks, Swagger documentation, and secured endpoints. +// - Connects to the MQTT broker and subscribes to relevant topics. +// +// Returns: +// - *Gateway: A pointer to the initialized Gateway instance. +// - error: An error if any of the initialization steps fail. +func NewGateway() (*Gateway, error) { + var gh = Gateway{} + var err error + + // Initialize the InfluxDB client + gh.createInfluxGateway() + + // Generate user accounts and credentials + gh.getUser() + + // Set up the REST API server + gh.createRestGateway() + + // Initialize the MQTT client and subscriptions + err = gh.createMQTTGateway() + if err != nil { + return nil, err + } + + // Start the HTTP server + err = gh.rest.Run(":8080") + if err != nil { + return nil, err + } + + return &gh, nil +} diff --git a/gateway/src/ProcessUpdate.go b/gateway/src/ProcessUpdate.go new file mode 100644 index 0000000..c61dfaf --- /dev/null +++ b/gateway/src/ProcessUpdate.go @@ -0,0 +1,77 @@ +package main + +import ( + "context" + "encoding/json" + "os" + "strings" + "time" + + paho "github.com/eclipse/paho.mqtt.golang" + influxdb "github.com/influxdata/influxdb-client-go/v2" + "github.com/labstack/gommon/log" +) + +type dataPoints = map[string]interface{} + +type updateEvent struct { + State string `json:"state"` + DataPoints dataPoints `json:"values"` +} + +// processUpdate processes device state updates received via MQTT and writes data points to InfluxDB. +// +// Parameters: +// - _ : The MQTT client instance (unused). +// - message: The MQTT message containing the topic and payload. +func (m *Gateway) processUpdate(_ paho.Client, message paho.Message) { + // Parse the MQTT topic to extract user, room, and device information. + topic := strings.Split(message.Topic(), "/") + if len(topic) != 4 { + log.Errorf("invalid topic: %s", message.Topic()) + return + } + + user := topic[0] + room := topic[1] + device := topic[2] + + // Decode the message payload into an updateEvent structure. + var event updateEvent + err := json.Unmarshal(message.Payload(), &event) + if err != nil { + log.Errorf("invalid update event payload: %s", string(message.Payload())) + } + + // Skip processing if no data points are provided. + if event.DataPoints == nil || len(event.DataPoints) == 0 { + return + } + + // Prepare the InfluxDB point with tags and fields. + MEASUREMENT_NAME, ok := os.LookupEnv("MEASUREMENT_NAME") + if !ok { + log.Error("MEASUREMENT_NAME not set, using default value: softweng") + MEASUREMENT_NAME = "softweng" + } + point := influxdb.NewPointWithMeasurement(MEASUREMENT_NAME). + SetTime(time.Now()). + AddTag("user", user). + AddTag("room", room). + AddTag("device", device) + for n, dp := range event.DataPoints { + point.AddField(n, dp) + } + + // Write the point to InfluxDB and handle errors. + err = m.influxApi.WritePoint(context.Background(), point) + if err != nil { + log.Errorf("failed to write data points to influx: %v", err) + } + + // Flush the InfluxDB client to ensure data is written. + err = m.influxApi.Flush(context.Background()) + if err != nil { + log.Errorf("failed to flush data points to influx: %v", err) + } +} diff --git a/gateway/src/PublishCommand.go b/gateway/src/PublishCommand.go new file mode 100644 index 0000000..087a648 --- /dev/null +++ b/gateway/src/PublishCommand.go @@ -0,0 +1,59 @@ +package main + +import ( + "errors" + _ "gateway-softweng/docs" + + _ "github.com/eclipse/paho.mqtt.golang" + "github.com/gin-gonic/gin" +) + +// Command represents the structure of the command to be published +// @Description Command structure for publishing +type Command struct { + Command string `json:"command" example:"UP" binding:"required"` +} + +// @Summary Publish command +// @Description Publish a command to a specific device in a room +// @Tags commands +// @Accept json +// @Produce json +// @Security BasicAuth +// @Param room query string true "Room name" example(Garage) +// @Param device query string true "Device name" example(Door) +// @Param command body main.Command true "Command to publish" +// @Success 200 {object} map[string]string "status:ok" +// @Failure 500 {object} gin.H +// @Router /raclette [post] +func (gh *Gateway) publishCommand(c *gin.Context) error { + // Get the user from the authenticated context + user := c.MustGet(gin.AuthUserKey).(string) + + // Get room and device from the query parameters + room, ret := c.GetQuery("room") + if !ret { + return errors.New(`no room found`) + } + device, ret := c.GetQuery("device") + if !ret { + return errors.New(`no device found`) + } + + // Define the JSON structure for the command + var json Command + + // Bind the JSON payload to the structure + err := c.Bind(&json) + if err != nil { + return err + } + + // Publish the command to the MQTT broker + topic := user + "/" + room + "/" + device + "/command/" + json.Command + token := gh.mqtt.Publish(topic, 1, false, "") + if token.Wait() && token.Error() != nil { + return token.Error() + } + return nil +} diff --git a/gateway/src/RequestInflux.go b/gateway/src/RequestInflux.go new file mode 100644 index 0000000..a194884 --- /dev/null +++ b/gateway/src/RequestInflux.go @@ -0,0 +1,90 @@ +package main + +import ( + "errors" + "fmt" + _ "github.com/eclipse/paho.mqtt.golang" + "github.com/gin-gonic/gin" + "github.com/labstack/gommon/log" + "golang.org/x/net/context" + "net/http" + "os" +) + +// swagger:model +// @Description Example response for Garage Door status +type GarageDoorExample struct { + // example: true + IsClosed bool `json:"IsClosed"` + // example: false + IsDownButtonPressed bool `json:"IsDownButtonPressed"` + // example: false + IsIRSensor bool `json:"IsIRSensor"` + // example: false + IsOpen bool `json:"IsOpen"` + // example: false + IsUpButtonPressed bool `json:"IsUpButtonPressed"` +} + +// @Summary Request Influx data +// @Description Request data from InfluxDB for a specific device in a room +// @Tags request +// @Accept json +// @Produce json +// @Security BasicAuth +// @Param room query string true "Room name" example(Garage) +// @Param device query string true "Device name" example(Door) +// @Success 200 {object} GarageDoorExample "Returns a map of field names to their latest values." +// @Failure 500 {object} gin.H +// @Router /raclette [get] +func (gh *Gateway) requestInflux(c *gin.Context) error { + // Get the user from the authenticated context + user := c.MustGet(gin.AuthUserKey).(string) + + // Get room and device from the query parameters + room, ret := c.GetQuery("room") + if !ret { + return errors.New(`no room found`) + } + device, ret := c.GetQuery("device") + if !ret { + return errors.New(`no device found`) + } + + org := user + bucket := user + + queryAPI := gh.influx.QueryAPI(org) + MEASUREMENT_NAME, ok := os.LookupEnv("MEASUREMENT_NAME") + if !ok { + log.Error("MEASUREMENT_NAME not set, using default value: softweng") + MEASUREMENT_NAME = "softweng" + } + // The Flux query uses a large range (-1000d) and aggregates the latest values. + // This ensures we always get the most recent data, even if the database contains old entries. + query := fmt.Sprintf(`from(bucket: %q) + |> range(start: -1000d) + |> filter(fn: (r) => r["_measurement"] == %q) + |> filter(fn: (r) => r["room"] == %q) + |> filter(fn: (r) => r["device"] == %q) + |> aggregateWindow(every: 1000d, fn: last, createEmpty: false) + `, bucket, MEASUREMENT_NAME, room, device) + results, err := queryAPI.Query(context.Background(), query) + if err != nil { + log.Fatal(err) + } + values := make(map[string]interface{}) + for results.Next() { + record := results.Record() + field := record.Field() + value := record.Value() + values[field] = value + fmt.Println(results.Record()) + } + if err := results.Err(); err != nil { + log.Fatal(err) + } + + c.JSON(http.StatusOK, values) + return nil +} diff --git a/gateway/src/docs/docs.go b/gateway/src/docs/docs.go new file mode 100644 index 0000000..a59ee16 --- /dev/null +++ b/gateway/src/docs/docs.go @@ -0,0 +1,41 @@ +// Package docs Code generated by swaggo/swag. DO NOT EDIT +package docs + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": {}, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": {}, + "securityDefinitions": { + "BasicAuth": { + "type": "basic" + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "rest.mse.kb28.ch", + BasePath: "/", + Schemes: []string{}, + Title: "Swagger SoftwEng API", + Description: "REST API for the SoftwEng course in MSE", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/gateway/src/docs/swagger.json b/gateway/src/docs/swagger.json new file mode 100644 index 0000000..daa2dbf --- /dev/null +++ b/gateway/src/docs/swagger.json @@ -0,0 +1,17 @@ +{ + "swagger": "2.0", + "info": { + "description": "REST API for the SoftwEng course in MSE", + "title": "Swagger SoftwEng API", + "contact": {}, + "version": "1.0" + }, + "host": "rest.mse.kb28.ch", + "basePath": "/", + "paths": {}, + "securityDefinitions": { + "BasicAuth": { + "type": "basic" + } + } +} \ No newline at end of file diff --git a/gateway/src/docs/swagger.yaml b/gateway/src/docs/swagger.yaml new file mode 100644 index 0000000..c50f85b --- /dev/null +++ b/gateway/src/docs/swagger.yaml @@ -0,0 +1,12 @@ +basePath: / +host: rest.mse.kb28.ch +info: + contact: {} + description: REST API for the SoftwEng course in MSE + title: Swagger SoftwEng API + version: "1.0" +paths: {} +securityDefinitions: + BasicAuth: + type: basic +swagger: "2.0" diff --git a/gateway/src/go.mod b/gateway/src/go.mod new file mode 100644 index 0000000..cda6a64 --- /dev/null +++ b/gateway/src/go.mod @@ -0,0 +1,64 @@ +module gateway-softweng + +go 1.23.0 + +toolchain go1.23.3 + +require ( + github.com/eclipse/paho.mqtt.golang v1.5.0 + github.com/gin-gonic/gin v1.10.0 + github.com/influxdata/influxdb-client-go/v2 v2.14.0 + github.com/labstack/gommon v0.4.0 + github.com/swaggo/files v1.0.1 + github.com/swaggo/gin-swagger v1.6.0 + github.com/swaggo/swag v1.16.4 + golang.org/x/net v0.38.0 +) + +require ( + github.com/KyleBanks/depth v1.2.1 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.6 // indirect + github.com/go-openapi/spec v0.20.4 // indirect + github.com/go-openapi/swag v0.19.15 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/oapi-codegen/runtime v1.0.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.2.2 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.36.0 // indirect + golang.org/x/sync v0.12.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/text v0.23.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/gateway/src/go.sum b/gateway/src/go.sum new file mode 100644 index 0000000..2cdcb12 --- /dev/null +++ b/gateway/src/go.sum @@ -0,0 +1,203 @@ +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= +github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjOsyvMGvD6o= +github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= +github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/influxdata/influxdb-client-go/v2 v2.14.0 h1:AjbBfJuq+QoaXNcrova8smSjwJdUHnwvfjMF71M1iI4= +github.com/influxdata/influxdb-client-go/v2 v2.14.0/go.mod h1:Ahpm3QXKMJslpXl3IftVLVezreAUtBOTZssDrjZEFHI= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= +github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oapi-codegen/runtime v1.0.0 h1:P4rqFX5fMFWqRzY9M/3YF9+aPSPPB06IzP2P7oOxrWo= +github.com/oapi-codegen/runtime v1.0.0/go.mod h1:LmCUMQuPB4M/nLXilQXhHw+BLZdDb18B34OO356yJ/A= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= +github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= +github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= +github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo= +github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A= +github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= +github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/gateway/src/main.go b/gateway/src/main.go new file mode 100644 index 0000000..06e4eb1 --- /dev/null +++ b/gateway/src/main.go @@ -0,0 +1,27 @@ +// @title Swagger SoftwEng API +// @version 1.0 +// @description REST API for the SoftwEng course in MSE +// @host rest.mse.kb28.ch +// @BasePath / +// @securityDefinitions.basic BasicAuth +// @in header +// @name Authorization +package main + +import ( + _ "gateway-softweng/docs" + "os" + "os/signal" + "syscall" +) + +func main() { + _, err := NewGateway() + if err != nil { + panic(err) + } + + keepAlive := make(chan os.Signal) + signal.Notify(keepAlive, os.Interrupt, syscall.SIGTERM) + <-keepAlive +}