Skip to content

Commit

Permalink
Support armv7 and armv8. v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Sep 6, 2023
1 parent f0b0785 commit eb52ab2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ RUN if [[ $TARGETARCH == 'arm' ]]; then \
curl -L https://go.dev/dl/go1.18.10.linux-armv6l.tar.gz |tar -xz -C /usr/local; \
fi

# Note that git is very important for codecov to discover the .codecov.yml
RUN apt update && apt install -y gcc g++ make patch

ADD . /g
WORKDIR /g
RUN make -j
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

FROM ossrs/srs:ubuntu20 as dist

RUN apt-get update -y && \
apt-get install -y tcpdump iputils-ping net-tools dstat iproute2 kmod python3-pip && \
rm -rf /var/lib/apt/lists/* && \
pip install tcconfig

WORKDIR /g
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ Load the docker image:
docker load -i tc-ui.tar.gz
```

## Development
## Development in macOS

Run Go API server in Ubuntu20 server or docker:

```bash
sudo docker build -t test -f Dockerfile .
sudo docker run --network=host --privileged --rm -it -v $(pwd):/g -w /g \
-v /lib/modules:/lib/modules:ro test go run .
docker build -t test -f Dockerfile.dev .
docker run --privileged --rm -it -v $(pwd):/g -w /g test go run .
```

> Note: Please run in Ubuntu20 server, macOS docker doesn't support ingress, which requires kernel module ifb.
Expand Down
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ func doMain(ctx context.Context) error {
}
})

ep = "/tc/api/v1/config/raw"
logger.Tf(ctx, "Handle %v", ep)
http.HandleFunc(ep, func(w http.ResponseWriter, r *http.Request) {
if err := TcRaw(logger.WithContext(ctx), w, r); err != nil {
ohttp.WriteError(ctx, w, r, err)
}
})

ep = "/tc/api/v1/init"
logger.Tf(ctx, "Handle %v", ep)
http.HandleFunc(ep, func(w http.ResponseWriter, r *http.Request) {
Expand Down
4 changes: 4 additions & 0 deletions tc.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ func TcSetup(ctx context.Context, w http.ResponseWriter, r *http.Request) error
return nil
}

func TcRaw(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
return nil
}

func TcInit(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
ifaces, err := queryIPNetInterfaces(nil)
if err != nil {
Expand Down

0 comments on commit eb52ab2

Please sign in to comment.