Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ build_android:
# *important* gradle does not handle symbolic links consistently
# the build dir swap is non-atomic
# note android/amd64 is needed for chromebook devices
WARPCTL="../warp/warpctl/build/$$(uname | tr '[:upper:]' '[:lower:]')/$$(uname -m)/warpctl"; \
BUILD_DIR=build/android.`date +%s`; \
WARP_VERSION=`warpctl ls version`; \
WARP_VERSION=`$$WARPCTL ls version`; \
mkdir -p "$$BUILD_DIR"; \
gomobile bind \
-target android/arm64,android/arm,android/amd64 -androidapi 24 \
Expand Down Expand Up @@ -50,8 +51,9 @@ build_ios:
build_apple:
# *important* Xcode does not handle symbolic links consistently
# the build dir swap is non-atomic
WARPCTL="../warp/warpctl/build/$$(uname | tr '[:upper:]' '[:lower:]')/$$(uname -m)/warpctl"; \
BUILD_DIR=build/apple.`date +%s`; \
WARP_VERSION=`warpctl ls version`; \
WARP_VERSION=`$$WARPCTL ls version`; \
mkdir -p "$$BUILD_DIR"; \
gomobile bind \
-ldflags "-X client.Version=$$WARP_VERSION" \
Expand Down
40 changes: 19 additions & 21 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ type NetworkClientInfo struct {
AuthTime *Time `json:"auth_time"`

Resident *NetworkClientResident `json:"resident,omitempty"`
ProvideMode ProvideMode `json:"provide_mode"`
ProvideMode /*ProvideMode*/int `json:"provide_mode"`
Connections *NetworkClientConnectionList `json:"connections"`
}

Expand Down Expand Up @@ -487,7 +487,7 @@ type FindLocationsResult struct {

type LocationResult struct {
LocationId *Id `json:"location_id"`
LocationType LocationType `json:"location_type"`
LocationType /*LocationType*/string `json:"location_type"`
Name string `json:"name"`
// FIXME
City string `json:"city,omitempty"`
Expand Down Expand Up @@ -694,23 +694,21 @@ func (self *Api) WalletValidateAddress(walletValidateAddress *WalletValidateAddr
})
}

type WalletType = string

// type WalletType = string
const (
WalletTypeCircleUserControlled WalletType = "circle_uc"
WalletTypeXch WalletType = "xch"
WalletTypeSol WalletType = "sol"
WalletTypeCircleUserControlled /*WalletType*/string = "circle_uc"
WalletTypeXch /*WalletType*/string = "xch"
WalletTypeSol /*WalletType*/string = "sol"
)

type Blockchain = string

// type Blockchain = string
const (
SOL Blockchain = "SOL"
MATIC Blockchain = "MATIC"
SOL /*Blockchain*/string = "SOL"
MATIC /*Blockchain*/string = "MATIC"
)

type CreateAccountWalletArgs struct {
Blockchain Blockchain `json:"blockchain"`
Blockchain /*Blockchain*/string `json:"blockchain"`
WalletAddress string `json:"wallet_address"`
DefaultTokenType string `json:"default_token_type"`
}
Expand Down Expand Up @@ -811,7 +809,7 @@ type CircleWalletInfo struct {
Blockchain string `json:"blockchain"`
BlockchainSymbol string `json:"blockchain_symbol"`
CreateDate string `json:"create_date"`
BalanceUsdcNanoCents NanoCents `json:"balance_usdc_nano_cents"`
BalanceUsdcNanoCents /*NanoCents*/int64 `json:"balance_usdc_nano_cents"`
}

type WalletBalanceCallback connect.ApiCallback[*WalletBalanceResult]
Expand Down Expand Up @@ -861,7 +859,7 @@ type WalletCircleTransferOutCallback connect.ApiCallback[*WalletCircleTransferOu

type WalletCircleTransferOutArgs struct {
ToAddress string `json:"to_address"`
AmountUsdcNanoCents NanoCents `json:"amount_usdc_nano_cents"`
AmountUsdcNanoCents /*NanoCents*/int64 `json:"amount_usdc_nano_cents"`
Terms bool `json:"terms"`
}

Expand Down Expand Up @@ -900,19 +898,19 @@ type TransferBalance struct {
NetworkId *Id `json:"network_id"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
StartBalanceByteCount ByteCount `json:"start_balance_byte_count"`
StartBalanceByteCount /*ByteCount*/int64 `json:"start_balance_byte_count"`
// how much money the platform made after subtracting fees
NetRevenue NanoCents `json:"net_revenue"`
BalanceByteCount ByteCount `json:"balance_byte_count"`
NetRevenue /*NanoCents*/int64 `json:"net_revenue"`
BalanceByteCount /*ByteCount*/int64 `json:"balance_byte_count"`
}

type SubscriptionBalanceCallback connect.ApiCallback[*SubscriptionBalanceResult]

type SubscriptionBalanceResult struct {
BalanceByteCount ByteCount `json:"balance_byte_count"`
BalanceByteCount /*ByteCount*/int64 `json:"balance_byte_count"`
CurrentSubscription *Subscription `json:"current_subscription,omitempty"`
ActiveTransferBalances *TransferBalanceList `json:"active_transfer_balances,omitempty"`
PendingPayoutUsdNanoCents NanoCents `json:"pending_payout_usd_nano_cents"`
PendingPayoutUsdNanoCents /*NanoCents*/int64 `json:"pending_payout_usd_nano_cents"`
WalletInfo *CircleWalletInfo `json:"wallet_info,omitempty"`
UpdateTime string `json:"update_time"`
}
Expand Down Expand Up @@ -1178,8 +1176,8 @@ func (self *Api) AccountPreferencesGet(callback AccountPreferencesGetCallback) {
**/

type TransferStatsResult struct {
PaidBytesProvided ByteCount `json:"paid_bytes_provided"`
UnpaidBytesProvided ByteCount `json:"unpaid_bytes_provided"`
PaidBytesProvided /*ByteCount*/int64 `json:"paid_bytes_provided"`
UnpaidBytesProvided /*ByteCount*/int64 `json:"unpaid_bytes_provided"`
}

type GetTransferStatsCallback connect.ApiCallback[*TransferStatsResult]
Expand Down
38 changes: 19 additions & 19 deletions connect_view_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (
"github.com/urnetwork/connect"
)

type ConnectionStatus = string
// type ConnectionStatus = string

const (
Disconnected ConnectionStatus = "DISCONNECTED"
Connecting ConnectionStatus = "CONNECTING"
DestinationSet ConnectionStatus = "DESTINATION_SET"
Connected ConnectionStatus = "CONNECTED"
Disconnected /*ConnectionStatus*/string = "DISCONNECTED"
Connecting /*ConnectionStatus*/string = "CONNECTING"
DestinationSet /*ConnectionStatus*/string = "DESTINATION_SET"
Connected /*ConnectionStatus*/string = "CONNECTED"
)

type SelectedLocationListener interface {
Expand Down Expand Up @@ -51,7 +51,7 @@ type ConnectViewController struct {

// this is set when the client is connected
connected bool
connectionStatus ConnectionStatus
connectionStatus /*ConnectionStatus*/string
selectedLocation *ConnectLocation
grid *ConnectGrid
// providerGridPointList *ProviderGridPointList
Expand Down Expand Up @@ -120,13 +120,13 @@ func (self *ConnectViewController) GetConnected() bool {
return self.connected
}

func (self *ConnectViewController) GetConnectionStatus() ConnectionStatus {
func (self *ConnectViewController) GetConnectionStatus() /*ConnectionStatus*/string {
self.stateLock.Lock()
defer self.stateLock.Unlock()
return self.connectionStatus
}

func (self *ConnectViewController) setConnectionStatus(status ConnectionStatus) {
func (self *ConnectViewController) setConnectionStatus(status /*ConnectionStatus*/string) {
changed := false
func() {
self.stateLock.Lock()
Expand Down Expand Up @@ -323,17 +323,17 @@ func (self *ConnectViewController) GetGrid() *ConnectGrid {
return self.grid
}

type ProviderState = string
// type ProviderState = string

const (
ProviderStateInEvaluation ProviderState = "InEvaluation"
ProviderStateEvaluationFailed ProviderState = "EvaluationFailed"
ProviderStateNotAdded ProviderState = "NotAdded"
ProviderStateAdded ProviderState = "Added"
ProviderStateRemoved ProviderState = "Removed"
ProviderStateInEvaluation /*ProviderState*/string = "InEvaluation"
ProviderStateEvaluationFailed /*ProviderState*/string = "EvaluationFailed"
ProviderStateNotAdded /*ProviderState*/string = "NotAdded"
ProviderStateAdded /*ProviderState*/string = "Added"
ProviderStateRemoved /*ProviderState*/string = "Removed"
)

func parseProviderState(state connect.ProviderState) (ProviderState, error) {
func parseProviderState(state connect.ProviderState) (/*ProviderState*/string, error) {
switch state {
case connect.ProviderStateInEvaluation:
return ProviderStateInEvaluation, nil
Expand All @@ -350,7 +350,7 @@ func parseProviderState(state connect.ProviderState) (ProviderState, error) {
}
}

func providerStateIsTerminal(state ProviderState) bool {
func providerStateIsTerminal(state /*ProviderState*/string) bool {
switch state {
case ProviderStateEvaluationFailed, ProviderStateNotAdded, ProviderStateRemoved:
return true
Expand All @@ -359,7 +359,7 @@ func providerStateIsTerminal(state ProviderState) bool {
}
}

func providerStateIsActive(state ProviderState) bool {
func providerStateIsActive(state /*ProviderState*/string) bool {
switch state {
case ProviderStateAdded:
return true
Expand All @@ -374,7 +374,7 @@ type ProviderGridPoint struct {
Y int32
ClientId *Id
// EventTime *Time
State ProviderState
State /*ProviderState*/string
// the time when this point will be removed
// the ui can transition out based on this value
EndTime *Time
Expand Down Expand Up @@ -682,7 +682,7 @@ func (self *ConnectGrid) windowMonitorEventCallback(windowExpandEvent *connect.W
done := false
windowSizeChanged := false
providerGridPointChanged := false
var connectionStatus ConnectionStatus
var connectionStatus /*ConnectionStatus*/string
func() {
self.stateLock.Lock()
defer self.stateLock.Unlock()
Expand Down
35 changes: 19 additions & 16 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ type ProvideSecretKeysListener interface {
}


type IpProtocol = int
const IpProtocolUnkown = 0
const IpProtocolUdp = 1
const IpProtocolTcp = 2
// type IpProtocol = int
const (
IpProtocolUnkown /*IpProtocol*/int = 0
IpProtocolUdp /*IpProtocol*/int = 1
IpProtocolTcp /*IpProtocol*/int = 2
)


// receive a packet into the local raw socket
type ReceivePacket interface {
ReceivePacket(ipVersion int, ipProtocol IpProtocol, packet []byte)
ReceivePacket(ipVersion int, ipProtocol /*IpProtocol*/int, packet []byte)
}

type TunnelChangeListener interface {
Expand Down Expand Up @@ -119,9 +122,9 @@ type Device interface {

GetConnectEnabled() bool

SetProvideMode(provideMode ProvideMode)
SetProvideMode(provideMode /*ProvideMode*/int)

GetProvideMode() ProvideMode
GetProvideMode() /*ProvideMode*/int

SetProvidePaused(providePaused bool)

Expand All @@ -137,7 +140,7 @@ type Device interface {

RemoveDestination()

SetDestination(location *ConnectLocation, specs *ProviderSpecList, provideMode ProvideMode)
SetDestination(location *ConnectLocation, specs *ProviderSpecList, provideMode /*ProvideMode*/int)

SetConnectLocation(location *ConnectLocation)

Expand Down Expand Up @@ -920,7 +923,7 @@ func (self *DeviceLocal) GetProvideSecretKeys() *ProvideSecretKeyList {
provideSecretKeyList := NewProvideSecretKeyList()
for provideMode, provideSecretKey := range provideSecretKeys {
provideSecretKey := &ProvideSecretKey{
ProvideMode: ProvideMode(provideMode),
ProvideMode: /*ProvideMode*/int(provideMode),
ProvideSecretKey: string(provideSecretKey),
}
provideSecretKeyList.Add(provideSecretKey)
Expand Down Expand Up @@ -960,7 +963,7 @@ func (self *DeviceLocal) GetConnectEnabled() bool {
return self.remoteUserNatClient != nil
}

func (self *DeviceLocal) SetProvideMode(provideMode ProvideMode) {
func (self *DeviceLocal) SetProvideMode(provideMode /*ProvideMode*/int) {
func() {
self.stateLock.Lock()
defer self.stateLock.Unlock()
Expand Down Expand Up @@ -997,12 +1000,12 @@ func (self *DeviceLocal) SetProvideMode(provideMode ProvideMode) {
self.provideChanged(self.GetProvideEnabled())
}

func (self *DeviceLocal) GetProvideMode() ProvideMode {
func (self *DeviceLocal) GetProvideMode() /*ProvideMode*/int {
maxProvideMode := protocol.ProvideMode_None
for provideMode, _ := range self.client.ContractManager().GetProvideModes() {
maxProvideMode = max(maxProvideMode, provideMode)
}
return ProvideMode(maxProvideMode)
return /*ProvideMode*/int(maxProvideMode)
}

func (self *DeviceLocal) SetProvidePaused(providePaused bool) {
Expand Down Expand Up @@ -1053,7 +1056,7 @@ func (self *DeviceLocal) RemoveDestination() {
self.SetDestination(nil, nil, ProvideModeNone)
}

func (self *DeviceLocal) SetDestination(location *ConnectLocation, specs *ProviderSpecList, provideMode ProvideMode) {
func (self *DeviceLocal) SetDestination(location *ConnectLocation, specs *ProviderSpecList, provideMode /*ProvideMode*/int) {
func() {
self.stateLock.Lock()
defer self.stateLock.Unlock()
Expand Down Expand Up @@ -1088,7 +1091,7 @@ func (self *DeviceLocal) SetDestination(location *ConnectLocation, specs *Provid
connect.DefaultApiMultiClientGeneratorSettings(),
)
remoteReceive := func(source connect.TransferPath, provideMode protocol.ProvideMode, ipPath *connect.IpPath, packet []byte) {
self.stats.UpdateRemoteReceive(ByteCount(len(packet)))
self.stats.UpdateRemoteReceive(/*ByteCount*/int64(len(packet)))
self.receive(source, provideMode, ipPath, packet)
}
multi := connect.NewRemoteUserNatMultiClientWithDefaults(
Expand Down Expand Up @@ -1160,7 +1163,7 @@ func (self *DeviceLocal) SendPacket(packet []byte, n int32) bool {
}()

if remoteUserNatClient != nil {
self.stats.UpdateRemoteSend(ByteCount(n))
self.stats.UpdateRemoteSend(/*ByteCount*/int64(n))
return remoteUserNatClient.SendPacket(
source,
protocol.ProvideMode_Network,
Expand All @@ -1182,7 +1185,7 @@ func (self *DeviceLocal) SendPacket(packet []byte, n int32) bool {

func (self *DeviceLocal) AddReceivePacket(receivePacket ReceivePacket) Sub {
receive := func(source connect.TransferPath, provideMode protocol.ProvideMode, ipPath *connect.IpPath, packet []byte) {
var ipProtocol IpProtocol
var ipProtocol /*IpProtocol*/int
switch ipPath.Protocol {
case connect.IpProtocolUdp:
ipProtocol = IpProtocolUdp
Expand Down
Loading
Loading