Skip to content

Commit

Permalink
Added V2Ray service to start command
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Feb 7, 2023
1 parent 4d52982 commit dda348f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FROM alpine:3.17
COPY --from=build /go/bin/sentinelnode /usr/local/bin/process
COPY --from=build /root/hnsd/hnsd /usr/local/bin/hnsd

RUN apk add --no-cache ip6tables unbound-dev wireguard-tools && \
RUN apk add --no-cache ip6tables unbound-dev v2ray wireguard-tools && \
rm -rf /tmp/* /var/tmp/*

CMD ["process"]
27 changes: 17 additions & 10 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/sentinel-official/dvpn-node/lite"
"github.com/sentinel-official/dvpn-node/node"
"github.com/sentinel-official/dvpn-node/rest"
"github.com/sentinel-official/dvpn-node/services/v2ray"
"github.com/sentinel-official/dvpn-node/services/wireguard"
wgtypes "github.com/sentinel-official/dvpn-node/services/wireguard/types"
"github.com/sentinel-official/dvpn-node/types"
Expand Down Expand Up @@ -75,21 +76,27 @@ func StartCmd() *cobra.Command {
}
}

log.Info("Creating IPv4 pool", "CIDR", types.IPv4CIDR)
ipv4Pool, err := wgtypes.NewIPv4PoolFromCIDR(types.IPv4CIDR)
if err != nil {
return err
}
var service types.Service
if config.Node.Type == "wireguard" {
log.Info("Creating IPv4 pool", "CIDR", types.IPv4CIDR)
ipv4Pool, err := wgtypes.NewIPv4PoolFromCIDR(types.IPv4CIDR)
if err != nil {
return err
}

log.Info("Creating IPv6 pool", "CIDR", types.IPv6CIDR)
ipv6Pool, err := wgtypes.NewIPv6PoolFromCIDR(types.IPv6CIDR)
if err != nil {
return err
log.Info("Creating IPv6 pool", "CIDR", types.IPv6CIDR)
ipv6Pool, err := wgtypes.NewIPv6PoolFromCIDR(types.IPv6CIDR)
if err != nil {
return err
}

service = wireguard.NewWireGuard(wgtypes.NewIPPool(ipv4Pool, ipv6Pool))
} else if config.Node.Type == "v2ray" {
service = v2ray.NewV2Ray()
}

var (
encoding = types.MakeEncodingConfig()
service = wireguard.NewWireGuard(wgtypes.NewIPPool(ipv4Pool, ipv6Pool))
reader = bufio.NewReader(cmd.InOrStdin())
)

Expand Down

0 comments on commit dda348f

Please sign in to comment.