Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Proto Kms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
Proto Kms
Commits
db64ead1
Commit
db64ead1
authored
1 year ago
by
Martin Stiemerling
Browse files
Options
Downloads
Patches
Plain Diff
Add docker-compose
parent
2fee6177
Branches
Branches containing commit
No related tags found
1 merge request
!3
Add docker-compose
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Dockerfile
+14
-0
14 additions, 0 deletions
Dockerfile
Makefile
+17
-0
17 additions, 0 deletions
Makefile
docker-compose.yml
+27
-0
27 additions, 0 deletions
docker-compose.yml
main.go
+27
-3
27 additions, 3 deletions
main.go
quantumlayer/quantumlayer-emu-prng.go
+4
-5
4 additions, 5 deletions
quantumlayer/quantumlayer-emu-prng.go
with
89 additions
and
8 deletions
Dockerfile
0 → 100644
+
14
−
0
View file @
db64ead1
ARG
GOLANG_VERSION=1.20.5
FROM
golang:$GOLANG_VERSION-alpine
as
builder
WORKDIR
/proto-kms/
RUN
apk add build-base
COPY
. .
RUN
--mount
=
type
=
cache,target
=
/root/go/pkg/mod
\
--mount
=
type
=
cache,target
=
/root/.cache/go-build
\
make build-proto-kms
FROM
${GITLAB_PROXY}golang:$GOLANG_VERSION-buster
WORKDIR
/app/
COPY
--from=builder /proto-kms/artifacts/proto-kms ./proto-kms
ENTRYPOINT
["./proto-kms"]
This diff is collapsed.
Click to expand it.
Makefile
0 → 100644
+
17
−
0
View file @
db64ead1
GOCMD
=
go
GOBUILD
=
$(
GOCMD
)
build
GOCLEAN
=
$(
GOCMD
)
clean
BUILD_ARTIFACTS_PATH
=
artifacts
pre
:
mkdir
-p
$(
BUILD_ARTIFACTS_PATH
)
build-proto-kms
:
pre
CGO_ENABLED
=
0
$(
GOBUILD
)
-o
$(
BUILD_ARTIFACTS_PATH
)
/proto-kms .
containerize-proto-kms
:
docker buildx build
--rm
-t
proto-kms
--load
-f
Dockerfile .
clean
:
$(
GOCLEAN
)
rm
-rf
$(
BUILD_ARTIFACTS_PATH
)
This diff is collapsed.
Click to expand it.
docker-compose.yml
0 → 100644
+
27
−
0
View file @
db64ead1
version
:
'
3'
services
:
proto-kms1
:
build
:
dockerfile
:
Dockerfile
command
:
[
"
-address"
,
"
172.100.20.11:55059"
,
"
-name"
,
"
proto-kms1"
]
networks
:
proto-kms-net
:
ipv4_address
:
172.100.20.10
proto-kms2
:
build
:
dockerfile
:
Dockerfile
command
:
[
"
-address"
,
"
172.100.20.10:55059"
,
"
-name"
,
"
proto-kms2"
]
networks
:
proto-kms-net
:
ipv4_address
:
172.100.20.11
networks
:
proto-kms-net
:
ipam
:
driver
:
default
config
:
-
subnet
:
"
172.100.20.0/24"
name
:
proto-kms-net
This diff is collapsed.
Click to expand it.
main.go
+
27
−
3
View file @
db64ead1
package
main
import
(
"flag"
"log"
"net"
...
...
@@ -9,11 +10,34 @@ import (
)
func
main
()
{
// my own Name
var
qlName1
,
udpQL1AddrString
string
// a name for potential self-testing
var
qlName2
,
udpQL2AddrString
string
// Setup flags that allows to initially provide a address to a second
// quantumlayer so generated keys can be fetched. This is mainly to simplify
// the initial setup process.
flag
.
StringVar
(
&
udpQL2AddrString
,
"address"
,
"[::1]:50900"
,
"The UDP address for my quantumlayer so keys can be fetched"
)
log
.
Println
(
"Welcome to the proto-kms"
)
flag
.
StringVar
(
&
ql1Name
,
"name"
,
"ekms-ql1"
,
"The name of the quantumlayer"
)
go
emulatedKMS
(
"kms-ql1"
,
"[::1]:50900"
,
"[::1]:50901"
)
emulatedKMS
(
"kms-ql2"
,
"[::1]:50901"
,
"[::1]:50900"
)
flag
.
StringVar
(
&
udpQL2AddrString
,
"address"
,
"[::1]:50901"
,
"The UDP address to a second quantumlayer so keys can be fetched"
)
flag
.
StringVar
(
&
ql2Name
,
"name"
,
"ekms-ql2"
,
"The name of the quantumlayer"
)
// Parse the provided flags
flag
.
Parse
()
log
.
Println
(
"Welcome to the proto-kms called: "
,
qlName
)
go
emulatedKMS
(
ql2Name
,
udpQL2AddrString
,
udpQL1AddrString
)
emulatedKMS
(
ql1Name
,
udpQL1AddrString
,
udpQL2AddrString
)
return
}
...
...
This diff is collapsed.
Click to expand it.
quantumlayer/quantumlayer-emu-prng.go
+
4
−
5
View file @
db64ead1
...
...
@@ -23,9 +23,9 @@ import (
)
type
QuantumPayloadElement
struct
{
BulkKeyId
int64
// the unique ID of this bulk of keys
BulkKeyLength
int
// the length, counted in bytes, of bulkKey
BulkKey
*
[]
byte
// the bulk key
BulkKeyId
int64
`json:"bulk-key-id"`
// the unique ID of this bulk of keys
BulkKeyLength
int
`json:"bulk-key-length"`
// the length, counted in bytes, of bulkKey
BulkKey
*
[]
byte
`json:"bulk-key"`
// the bulk key
}
type
QuantumlayerEmuPRNG
struct
{
...
...
@@ -74,6 +74,7 @@ func (qlemuprng *QuantumlayerEmuPRNG) PowerOn(localQLAddress ...string) {
udpAddrString
=
localQLAddress
[
0
]
}
log
.
Printf
(
"localQLAddress is %s"
,
localQLAddress
[
0
])
// This reads random numbers from other Quantum end
udpSrvPort
,
err
:=
net
.
ResolveUDPAddr
(
"udp"
,
udpAddrString
)
if
err
!=
nil
{
...
...
@@ -178,7 +179,6 @@ func (qlemuprng *QuantumlayerEmuPRNG) AddPeer(addr net.UDPAddr) {
}
}
}(
ctx
)
}
func
(
qlemuprng
*
QuantumlayerEmuPRNG
)
RemovePeer
()
{
...
...
@@ -297,5 +297,4 @@ func (store *NumberStore) receiveNumbers(incoming chan QuantumPayloadElement) {
store
.
mu
.
Unlock
()
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment