Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-09-21 15:03:57 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-09-21 15:03:57 +0300
commite33a670211b5a63b5db4c024b95ec2d96d2ef463 (patch)
treef0d1c0dd14200f4649621918e550ed2eb1927c06
parent529988bfe243a610ea5414a48567585c3c3337aa (diff)
Add abstract interfaces for a domain source nad serving
We use Source to get an information about a domain, and we use Serving to handle a request.
-rw-r--r--internal/serving/handler.go7
-rw-r--r--internal/serving/serving.go9
-rw-r--r--internal/source/source.go14
3 files changed, 30 insertions, 0 deletions
diff --git a/internal/serving/handler.go b/internal/serving/handler.go
new file mode 100644
index 00000000..60b8dba9
--- /dev/null
+++ b/internal/serving/handler.go
@@ -0,0 +1,7 @@
+package serving
+
+// LegacyHandler is a struct that encapsulates legacy ResponseWriter and
+// Request with all the details about a domain / address that needs to be
+// served
+type LegacyHandler struct {
+}
diff --git a/internal/serving/serving.go b/internal/serving/serving.go
new file mode 100644
index 00000000..bc0bb61d
--- /dev/null
+++ b/internal/serving/serving.go
@@ -0,0 +1,9 @@
+package serving
+
+import "net/http"
+
+// Serving represents an interface used to serve pages for a given domain /
+// address
+type Serving interface {
+ ServeHTTP(http.ResponseWriter, *http.Request)
+}
diff --git a/internal/source/source.go b/internal/source/source.go
new file mode 100644
index 00000000..23dc72fe
--- /dev/null
+++ b/internal/source/source.go
@@ -0,0 +1,14 @@
+package source
+
+import (
+ "net/http"
+
+ "gitlab.com/gitlab-org/gitlab-pages/internal/domain"
+)
+
+// Source represents a source of information about a domain. Whenever a request
+// appears a concret implementation of a Source should find a domain that is
+// needed to handle the request and serve pages
+type Source interface {
+ GetDomain(*http.Request) *domain.Domain
+}