@ohos/xmpp_resolve
Introduction
Based on the open source software @xmpp/client-resolve, this project uses TypeScript to implement similar capabilities. It provides OpenHarmony a library for resolving DNS and HTTP paths.
Supported Features
- HTTP path resolution
How to Install
-
Configure the OpenHarmony ohpm environment. For details, see OpenHarmony HAR.
-
Run the following installation command:
ohpm install @ohos/xmpp_resolve
Available APIs
Supported APIs
| API | Parameter | Description |
|---|---|---|
| resolve(...args) | args: server address information | Resolves service information to obtain the HTTP path resolution result. |
Example
improt {resolve} from "@ohos/xmpp_resolve";
resolve("example.com", "xmpp-client").then(records => {
console.log(records);
});
How to Use
Resolving DNS SRV and HTTP
The resolve API takes one or more parameters, including the server domain name and service type.
It returns a promise, which uses an array to contain the DNS SRV record and HTTP path resolution result.
If DNS resolution is supported, you can use dns.resolve independently.
About obfuscation
- Code obfuscation, please seeCode Obfuscation
- If you want the xmpp_resolve library not to be obfuscated during code obfuscation, you need to add corresponding exclusion rules in the obfuscation rule configuration file obfuscation-rules.txt:
-keep
./oh_modules/@ohos/xmpp_resolve
Constraints
This project has been verified in the following version:
- DevEco Studio: 5.0.3.200, OpenHarmony SDK: API 12 (5.0.0.21-Canary2)
Directory Structure
|---- @ohos/xmpp_resolve
| |---- entry # Sample code
| |---- src
| |---- main # Sample code
| |---- ohosTest # xts code
| |---- library # @ohos/xmpp_resolve library
| |---- ets
| |---- lib # Main dependencies
| |---- types # External APIs
| |---- index.js # Main entry file
| |---- index.d.ts # Main declaration file of the external APIs
| |---- README.md # Readme
| |---- README_zh.md # Readme
How to Contribute
If you find any problem when using @ohos/xmpp_resolve, submit an issue or a PR.
License
This project is licensed under ISC License.