All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hope.kola.contract.faker.IP6Pulsar Maven / Gradle / Ivy

There is a newer version: 1.1.2-RELEASE
Show newest version
package hope.kola.contract.faker;

/** refer: https://zhuanlan.zhihu.com/p/366049271 */
public class IP6Pulsar implements Pulsar {

  private static int next1to4() {
    return FAKER.number().numberBetween(1, 4);
  }

  /**
   * 
   *     ip.match(/^([a-f0-9]{1,4}:){7}[a-f0-9]{1,4}$/i)
   * 
   *
   * @return
   */
  @Override
  public String next() {
    String sb =
        FAKER.random().hex(next1to4())
            + ":"
            + FAKER.random().hex(next1to4())
            + ":"
            + FAKER.random().hex(next1to4())
            + ":"
            + FAKER.random().hex(next1to4())
            + ":"
            + FAKER.random().hex(next1to4())
            + ":"
            + FAKER.random().hex(next1to4())
            + ":"
            + FAKER.random().hex(next1to4())
            + ":"
            + FAKER.random().hex(next1to4());

    return sb;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy