Skip to content

Commit

Permalink
chore: rename estkme-rlpa-server to estkme-cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
damonto committed Apr 1, 2024
1 parent 0e0a94a commit 5c7f696
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 60 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
id: go
- name: Build for ${{ matrix.build.name }}
run: |
CGO_ENABLED=0 GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} go build -trimpath -ldflags="-w -s" -o estkme-rlpa-server-${{ matrix.build.os }}-${{ matrix.build.arch }}
CGO_ENABLED=0 GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} go build -trimpath -ldflags="-w -s" -o estkme-cloud-${{ matrix.build.os }}-${{ matrix.build.arch }}
- name: Upload ${{ matrix.build.name }} to Artifact
uses: actions/upload-artifact@v4
with:
name: estkme-rlpa-server-${{ matrix.build.os }}-${{ matrix.build.arch }}
path: estkme-rlpa-server-${{ matrix.build.os }}-${{ matrix.build.arch }}
name: estkme-cloud-${{ matrix.build.os }}-${{ matrix.build.arch }}
path: estkme-cloud-${{ matrix.build.os }}-${{ matrix.build.arch }}

release:
name: Release
Expand All @@ -51,8 +51,8 @@ jobs:
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: '*'
pattern: "*"
- name: Release
uses: softprops/action-gh-release@v2
with:
files: '*'
files: "*"
5 changes: 2 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/estkme-rlpa-server
ghcr.io/${{ github.repository_owner }}/estkme-rlpa-server
${{ github.repository_owner }}/estkme-cloud
ghcr.io/${{ github.repository_owner }}/estkme-cloud
tags: |
type=schedule
type=ref,event=branch
Expand Down Expand Up @@ -54,7 +54,6 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ COPY . .

RUN set -ex \
&& go mod download \
&& go build -trimpath -ldflags="-w -s" -o estkme-rlpa-server main.go
&& go build -trimpath -ldflags="-w -s" -o estkme-cloud main.go

FROM alpine:latest

WORKDIR /app

COPY --from=builder /app/estkme-rlpa-server /app/estkme-rlpa-server
COPY --from=builder /app/estkme-cloud /app/estkme-cloud

RUN set -ex \
&& apk add --no-cache gcompat ca-certificates pcsc-lite-libs libcurl \
&& update-ca-certificates \
&& chmod +x /app/estkme-rlpa-server
&& chmod +x /app/estkme-cloud

EXPOSE 1888

CMD ["/app/estkme-rlpa-server"]
CMD ["/app/estkme-cloud"]
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# eSTK.me Remote LPA Server
# eSTK.me Cloud Server

### Introduction

This is a simple server designed to handle requests from the eSTK.me removable eUICC, such as downloads and notifications.

The project is written in Go and is just a toy project, not suitable for production use.

If you want to deploy your own rLPA server, I recommend you to use the [official rLPA server](https://github.com/estkme-group/lpac/blob/main/src/rlpa-server.php) instead.
If you want to deploy your own eSTK.me cloud server, I recommend you to use the [official eSTK.me cloud server](https://github.com/estkme-group/lpac/blob/main/src/cloud-server.php) instead.

### Installation

You can download the binary release from the [releases page](https://github.com/damonto/estkme-rlpa-server/releases) or you can build it yourself.
You can download the binary release from the [releases page](https://github.com/damonto/estkme-cloud/releases) or you can build it yourself.

If you want to build it yourself, you can run the following commands:
```bash
git clone git@github.com:damonto/estkme-rlpa-server.git
cd estkme-rlpa-server
go build -trimpath -ldflags="-w -s" -o estkme-rlpa-server main.go
git clone git@github.com:damonto/estkme-cloud.git
cd estkme-cloud
go build -trimpath -ldflags="-w -s" -o estkme-cloud main.go
```

You can also install the latest version using the following command:

```bash
go install github.com/damonto/estkme-rlpa-server@latest
go install github.com/damonto/estkme-cloud@latest
```

Sometimes, you might need to set executable permissions for the binary file using the following command:

```bash
chmod +x estkme-rlpa-server
chmod +x estkme-cloud
```

You must also install the following dependencies:
Expand All @@ -43,19 +43,19 @@ pacman -S pcsclite
Once done, you can run the server using the following command:

```bash
./estkme-rlpa-server
./estkme-cloud
```

If you want to change the default port, lpac version or data directory, you can use the following flags:

```plaintext
./estkme-rlpa-server --help
./estkme-cloud --help
Usage of estkme-rlpa-server:
Usage of estkme-cloud:
-data-dir string
data directory (default "/home/user/workspace/estkme-rlpa-server/data")
data directory (default "/home/user/workspace/estkme-cloud/data")
-listen-address string
rLPA server listen address (default ":1888")
eSTK.me cloud server listen address (default ":1888")
-lpac-version string
lpac version (default "v2.0.0-beta.1")
-dont-download
Expand All @@ -64,18 +64,18 @@ Usage of estkme-rlpa-server:

If you wish to run the program in the background, you can utilize the systemctl command. Here is an example of how to achieve this:

1. Start by creating a service file in the /etc/systemd/system directory. For instance, you can name the file estkme-rlpa-server.service and include the following content:
1. Start by creating a service file in the /etc/systemd/system directory. For instance, you can name the file estkme-cloud.service and include the following content:

```plaintext
[Unit]
Description=eSTK.me rLPA Server
Description=eSTK.me Cloud
After=network.target
[Service]
Type=simple
User=your_user_here
Restart=on-failure
ExecStart=/your/binary/path/here/estkme-rlpa-server
ExecStart=/your/binary/path/here/estkme-cloud
RestartSec=10s
TimeoutStopSec=30s
Expand All @@ -85,23 +85,23 @@ WantedBy=multi-user.target
2. Then, use the following command to start the service:

```bash
systemctl start estkme-rlpa-server
systemctl start estkme-cloud
```

3. If you want the service to start automatically upon system boot, use the following command:

```bash
systemctl enable estkme-rlpa-server
systemctl enable estkme-cloud
```

#### Docker

You can also run the server using Docker. You can use the following command to run the server:

```bash
docker run -d --name estkme-rlpa-server -p 1888:1888 damonto/estkme-rlpa-server:latest
docker run -d --name estkme-cloud -p 1888:1888 damonto/estkme-cloud:latest
# or use the GitHub Container Registry
docker run -d --name estkme-rlpa-server -p 1888:1888 -v ghcr.io/damonto/estkme-rlpa-server:latest
docker run -d --name estkme-cloud -p 1888:1888 -v ghcr.io/damonto/estkme-cloud:latest
```

### Usage
Expand All @@ -110,7 +110,7 @@ Once the server is running, the server will listen on the specified port (defaul

#### Download

To download a profile, you should enable the remote LPA feature on the eUICC and set the rLPA server URL to the server address. The server will handle the download request and download the profile to the eUICC.
To download a profile, you should enable the `Cloud+` feature on the eUICC and set the eSTK.me cloud server URL to the server address. The server will handle the download request and download the profile to the eUICC.

The server support downloading profiles with confirmation code and custom IMEI.

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/damonto/estkme-rlpa-server
module github.com/damonto/estkme-cloud

go 1.22.1
6 changes: 3 additions & 3 deletions internal/rlpa/apdu.go → internal/cloud/apdu.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package rlpa
package cloud

import (
"encoding/hex"
"sync"

"github.com/damonto/estkme-rlpa-server/internal/transmitter"
"github.com/damonto/estkme-cloud/internal/driver"
)

type apdu struct {
Expand All @@ -13,7 +13,7 @@ type apdu struct {
receiver chan []byte
}

func NewAPDU(conn *Conn) transmitter.APDU {
func NewAPDU(conn *Conn) driver.APDU {
return &apdu{conn: conn, receiver: make(chan []byte, 1)}
}

Expand Down
6 changes: 3 additions & 3 deletions internal/rlpa/conn.go → internal/cloud/conn.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rlpa
package cloud

import (
"encoding/binary"
Expand All @@ -8,15 +8,15 @@ import (
"net"
"sync"

"github.com/damonto/estkme-rlpa-server/internal/transmitter"
"github.com/damonto/estkme-cloud/internal/driver"
)

type Handler = func(conn *Conn, data []byte) error

type Conn struct {
Id string
Conn *net.TCPConn
APDU transmitter.APDU
APDU driver.APDU
lock sync.Mutex
isClosed bool
handlers map[byte]Handler
Expand Down
2 changes: 1 addition & 1 deletion internal/rlpa/constants.go → internal/cloud/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rlpa
package cloud

const (
TagMessageBox = 0x00
Expand Down
4 changes: 2 additions & 2 deletions internal/rlpa/download.go → internal/cloud/download.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package rlpa
package cloud

import (
"bytes"
"errors"

"github.com/damonto/estkme-rlpa-server/internal/lpac"
"github.com/damonto/estkme-cloud/internal/lpac"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/rlpa/manager.go → internal/cloud/manager.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rlpa
package cloud

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package rlpa
package cloud

import (
"fmt"
"log/slog"

"github.com/damonto/estkme-rlpa-server/internal/lpac"
"github.com/damonto/estkme-cloud/internal/lpac"
)

func processNotification(conn *Conn) error {
Expand Down
4 changes: 2 additions & 2 deletions internal/rlpa/server.go → internal/cloud/server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rlpa
package cloud

import (
"encoding/hex"
Expand Down Expand Up @@ -34,7 +34,7 @@ func (s *server) Listen(address string) error {
if err != nil {
return err
}
slog.Info("rLPA server is running on", "address", address)
slog.Info("cloud server is running on", "address", address)

for {
conn, err := s.listener.AcceptTCP()
Expand Down
2 changes: 1 addition & 1 deletion internal/rlpa/util.go → internal/cloud/util.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rlpa
package cloud

import "unicode"

Expand Down
2 changes: 1 addition & 1 deletion internal/transmitter/apdu.go → internal/driver/apdu.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package transmitter
package driver

type APDU interface {
Lock() error
Expand Down
8 changes: 4 additions & 4 deletions internal/lpac/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
"path/filepath"
"runtime"

"github.com/damonto/estkme-rlpa-server/internal/config"
"github.com/damonto/estkme-rlpa-server/internal/transmitter"
"github.com/damonto/estkme-cloud/internal/config"
"github.com/damonto/estkme-cloud/internal/driver"
)

type Cmder struct {
APDU transmitter.APDU
APDU driver.APDU
}

func NewCmder(APDU transmitter.APDU) *Cmder {
func NewCmder(APDU driver.APDU) *Cmder {
return &Cmder{APDU: APDU}
}

Expand Down
12 changes: 6 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"os/signal"
"path/filepath"

"github.com/damonto/estkme-rlpa-server/internal/config"
"github.com/damonto/estkme-rlpa-server/internal/lpac"
"github.com/damonto/estkme-rlpa-server/internal/rlpa"
"github.com/damonto/estkme-cloud/internal/cloud"
"github.com/damonto/estkme-cloud/internal/config"
"github.com/damonto/estkme-cloud/internal/lpac"
)

func init() {
cwd, _ := os.Getwd()
flag.StringVar(&config.C.ListenAddress, "listen-address", ":1888", "rLPA server listen address")
flag.StringVar(&config.C.ListenAddress, "listen-address", ":1888", "eSTK.me cloud server listen address")
flag.StringVar(&config.C.DataDir, "data-dir", filepath.Join(cwd, "data"), "data directory")
flag.StringVar(&config.C.LpacVersion, "lpac-version", "v2.0.0", "lpac version")
flag.BoolVar(&config.C.DontDownload, "dont-download", false, "don't download lpac")
Expand All @@ -34,8 +34,8 @@ func main() {
}
}

manager := rlpa.NewManager()
server := rlpa.NewServer(manager)
manager := cloud.NewManager()
server := cloud.NewServer(manager)

go func() {
if err := server.Listen(config.C.ListenAddress); err != nil {
Expand Down

0 comments on commit 5c7f696

Please sign in to comment.