import * as jspb from 'google-protobuf' ; import * as grpcWeb from 'grpc-web' ; import * as googleProtobufWrappers from 'google-protobuf/google/protobuf/wrappers_pb' ; export class Server { private client_ = new grpcWeb . GrpcWebClientBase ( { format : 'text' , } ) ; private methodInfoInfo = new grpcWeb . MethodDescriptor < InfoReq , InfoRes > ( "Info" , null , InfoReq , InfoRes , ( req ) => req . serializeBinary ( ) , InfoRes . deserializeBinary ) ; constructor ( private hostname , private defaultMetadata ? ) { } info ( req , metadata ? ) { return new Promise ( ( resolve , reject ) => { const message = InfoReqFromObject ( req ) ; this . client_ . rpcCall ( this . hostname + '/proto.Server/Info' , message , Object . assign ( { } , this . defaultMetadata ? this . defaultMetadata ( ) : { } , metadata ) , this . methodInfoInfo , ( err , res ) => { if ( err ) { reject ( err ) ; } else { resolve ( res . toObject ( ) ) ; } } ) ; } ) ; } } export declare namespace InfoReq { export type AsObject = { } ; } export class InfoReq extends jspb . Message { private static repeatedFields_ = [ ] ; constructor ( data ? ) { super ( ) ; jspb . Message . initialize ( this , data || [ ] , 0 , - 1 , InfoReq . repeatedFields_ , null ) ; } serializeBinary ( ) { const writer = new jspb . BinaryWriter ( ) ; InfoReq . serializeBinaryToWriter ( this , writer ) ; return writer . getResultBuffer ( ) ; } toObject ( ) { let f ; return { } ; } static serializeBinaryToWriter ( message , writer ) { } static deserializeBinary ( bytes ) { var reader = new jspb . BinaryReader ( bytes ) ; var message = new InfoReq ( ) ; return InfoReq . deserializeBinaryFromReader ( message , reader ) ; } static deserializeBinaryFromReader ( message , reader ) { while ( reader . nextField ( ) ) { if ( reader . isEndGroup ( ) ) { break ; } const field = reader . getFieldNumber ( ) ; switch ( field ) { default : reader . skipField ( ) ; break ; } } return message ; } } export declare namespace InfoRes { export type AsObject = { publicKey : string ; host ? : googleProtobufWrappers . StringValue . AsObject ; port : number ; hostVpnIp : string ; metadataEnabled : boolean ; isAdmin : boolean ; allowedIps : string ; dnsEnabled : boolean ; dnsAddress : string ; } ; } export class InfoRes extends jspb . Message { private static repeatedFields_ = [ ] ; constructor ( data ? ) { super ( ) ; jspb . Message . initialize ( this , data || [ ] , 0 , - 1 , InfoRes . repeatedFields_ , null ) ; } getPublicKey ( ) { return jspb . Message . getFieldWithDefault ( this , 1 , "" ) ; } setPublicKey ( value ) { ( jspb . Message as any ) . setProto3StringField ( this , 1 , value ) ; } getHost ( ) { return jspb . Message . getWrapperField ( this , googleProtobufWrappers . StringValue , 2 ) ; } setHost ( value ? ) { ( jspb . Message as any ) . setWrapperField ( this , 2 , value ) ; } getPort ( ) { return jspb . Message . getFieldWithDefault ( this , 3 , 0 ) ; } setPort ( value ) { ( jspb . Message as any ) . setProto3IntField ( this , 3 , value ) ; } getHostVpnIp ( ) { return jspb . Message . getFieldWithDefault ( this , 4 , "" ) ; } setHostVpnIp ( value ) { ( jspb . Message as any ) . setProto3StringField ( this , 4 , value ) ; } getMetadataEnabled ( ) { return jspb . Message . getFieldWithDefault ( this , 5 , false ) ; } setMetadataEnabled ( value ) { ( jspb . Message as any ) . setProto3BooleanField ( this , 5 , value ) ; } getIsAdmin ( ) { return jspb . Message . getFieldWithDefault ( this , 6 , false ) ; } setIsAdmin ( value ) { ( jspb . Message as any ) . setProto3BooleanField ( this , 6 , value ) ; } getAllowedIps ( ) { return jspb . Message . getFieldWithDefault ( this , 7 , "" ) ; } setAllowedIps ( value ) { ( jspb . Message as any ) . setProto3StringField ( this , 7 , value ) ; } getDnsEnabled ( ) { return jspb . Message . getFieldWithDefault ( this , 8 , false ) ; } setDnsEnabled ( value ) { ( jspb . Message as any ) . setProto3BooleanField ( this , 8 , value ) ; } getDnsAddress ( ) { return jspb . Message . getFieldWithDefault ( this , 9 , "" ) ; } setDnsAddress ( value ) { ( jspb . Message as any ) . setProto3StringField ( this , 9 , value ) ; } serializeBinary ( ) { const writer = new jspb . BinaryWriter ( ) ; InfoRes . serializeBinaryToWriter ( this , writer ) ; return writer . getResultBuffer ( ) ; } toObject ( ) { let f ; return { publicKey : this . getPublicKey ( ) , host : ( f = this . getHost ( ) ) && f . toObject ( ) , port : this . getPort ( ) , hostVpnIp : this . getHostVpnIp ( ) , metadataEnabled : this . getMetadataEnabled ( ) , isAdmin : this . getIsAdmin ( ) , allowedIps : this . getAllowedIps ( ) , dnsEnabled : this . getDnsEnabled ( ) , dnsAddress : this . getDnsAddress ( ) , } ; } static serializeBinaryToWriter ( message , writer ) { const field1 = message . getPublicKey ( ) ; if ( field1 . length > 0 ) { writer . writeString ( 1 , field1 ) ; } const field2 = message . getHost ( ) ; if ( field2 != null ) { writer . writeMessage ( 2 , field2 , googleProtobufWrappers . StringValue . serializeBinaryToWriter ) ; } const field3 = message . getPort ( ) ; if ( field3 != 0 ) { writer . writeInt32 ( 3 , field3 ) ; } const field4 = message . getHostVpnIp ( ) ; if ( field4 . length > 0 ) { writer . writeString ( 4 , field4 ) ; } const field5 = message . getMetadataEnabled ( ) ; if ( field5 != false ) { writer . writeBool ( 5 , field5 ) ; } const field6 = message . getIsAdmin ( ) ; if ( field6 != false ) { writer . writeBool ( 6 , field6 ) ; } const field7 = message . getAllowedIps ( ) ; if ( field7 . length > 0 ) { writer . writeString ( 7 , field7 ) ; } const field8 = message . getDnsEnabled ( ) ; if ( field8 != false ) { writer . writeBool ( 8 , field8 ) ; } const field9 = message . getDnsAddress ( ) ; if ( field9 . length > 0 ) { writer . writeString ( 9 , field9 ) ; } } static deserializeBinary ( bytes ) { var reader = new jspb . BinaryReader ( bytes ) ; var message = new InfoRes ( ) ; return InfoRes . deserializeBinaryFromReader ( message , reader ) ; } static deserializeBinaryFromReader ( message , reader ) { while ( reader . nextField ( ) ) { if ( reader . isEndGroup ( ) ) { break ; } const field = reader . getFieldNumber ( ) ; switch ( field ) { case 1 : const field1 = reader . readString ( ) ; message . setPublicKey ( field1 ) ; break ; case 2 : const field2 = new googleProtobufWrappers . StringValue ( ) ; reader . readMessage ( field2 , googleProtobufWrappers . StringValue . deserializeBinaryFromReader ) ; message . setHost ( field2 ) ; break ; case 3 : const field3 = reader . readInt32 ( ) ; message . setPort ( field3 ) ; break ; case 4 : const field4 = reader . readString ( ) ; message . setHostVpnIp ( field4 ) ; break ; case 5 : const field5 = reader . readBool ( ) ; message . setMetadataEnabled ( field5 ) ; break ; case 6 : const field6 = reader . readBool ( ) ; message . setIsAdmin ( field6 ) ; break ; case 7 : const field7 = reader . readString ( ) ; message . setAllowedIps ( field7 ) ; break ; case 8 : const field8 = reader . readBool ( ) ; message . setDnsEnabled ( field8 ) ; break ; case 9 : const field9 = reader . readString ( ) ; message . setDnsAddress ( field9 ) ; break ; default : reader . skipField ( ) ; break ; } } return message ; } } function InfoReqFromObject ( obj ) { if ( obj === undefined ) { return undefined ; } const message = new InfoReq ( ) ; return message ; } function InfoResFromObject ( obj ) { if ( obj === undefined ) { return undefined ; } const message = new InfoRes ( ) ; message . setPublicKey ( obj . publicKey ) ; message . setHost ( StringValueFromObject ( obj . host ) ) ; message . setPort ( obj . port ) ; message . setHostVpnIp ( obj . hostVpnIp ) ; message . setMetadataEnabled ( obj . metadataEnabled ) ; message . setIsAdmin ( obj . isAdmin ) ; message . setAllowedIps ( obj . allowedIps ) ; message . setDnsEnabled ( obj . dnsEnabled ) ; message . setDnsAddress ( obj . dnsAddress ) ; return message ; } function StringValueFromObject ( obj ) { if ( obj === undefined ) { return undefined ; } const message = new googleProtobufWrappers . StringValue ( ) ; message . setValue ( obj . value ) ; return message ; }