X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FNetAddress.ts;h=d80b5189cf2c2a2818f6f28a38f0c041b0f7e5e2;hb=d2925e24ac4643ec22eb73495f0424e27def2545;hp=b1d54a1700e446965059ed470b85f0d5c62ace3d;hpb=b6cc0960eaee5a5bbc7fde79a56152d6dcd649d8;p=ldk-java diff --git a/ts/structs/NetAddress.ts b/ts/structs/NetAddress.ts index b1d54a17..d80b5189 100644 --- a/ts/structs/NetAddress.ts +++ b/ts/structs/NetAddress.ts @@ -45,12 +45,10 @@ export class IPv6 extends NetAddress { } } export class OnionV2 extends NetAddress { - public addr: Uint8Array; - public port: number; + public onion_v2: Uint8Array; private constructor(ptr: number, obj: bindings.LDKNetAddress.OnionV2) { super(null, ptr); - this.addr = obj.addr; - this.port = obj.port; + this.onion_v2 = obj.onion_v2; } } export class OnionV3 extends NetAddress { @@ -66,6 +64,11 @@ export class OnionV3 extends NetAddress { this.port = obj.port; } } + public number clone_ptr() { + number ret = bindings.NetAddress_clone_ptr(this.ptr); + return ret; + } + public NetAddress clone() { number ret = bindings.NetAddress_clone(this.ptr); NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); @@ -73,6 +76,34 @@ export class OnionV3 extends NetAddress { return ret_hu_conv; } + public static NetAddress constructor_ipv4(Uint8Array addr, number port) { + number ret = bindings.NetAddress_ipv4(InternalUtils.check_arr_len(addr, 4), port); + NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static NetAddress constructor_ipv6(Uint8Array addr, number port) { + number ret = bindings.NetAddress_ipv6(InternalUtils.check_arr_len(addr, 16), port); + NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static NetAddress constructor_onion_v2(Uint8Array a) { + number ret = bindings.NetAddress_onion_v2(InternalUtils.check_arr_len(a, 12)); + NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static NetAddress constructor_onion_v3(Uint8Array ed25519_pubkey, number checksum, number version, number port) { + number ret = bindings.NetAddress_onion_v3(InternalUtils.check_arr_len(ed25519_pubkey, 32), checksum, version, port); + NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + public Uint8Array write() { Uint8Array ret = bindings.NetAddress_write(this.ptr); return ret;